// 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 "cmakeconfigitem.h" #include #include #include #include namespace CMakeProjectManager::Internal { namespace PresetsDetails { class ValueStrategyPair { public: std::optional value; enum class Strategy : bool { set, external }; std::optional strategy; }; class Warnings { public: std::optional dev; std::optional deprecated; std::optional uninitialized = false; std::optional unusedCli = true; std::optional systemVars = false; }; class Errors { public: std::optional dev; std::optional deprecated; }; class Debug { public: std::optional output = false; std::optional tryCompile = false; std::optional find = false; }; class Condition { public: QString type; bool isNull() const { return type == "null"; } bool isConst() const { return type == "const"; } bool isEquals() const { return type == "equals"; } bool isNotEquals() const { return type == "notEquals"; } bool isInList() const { return type == "inList"; } bool isNotInList() const { return type == "notInList"; } bool isMatches() const { return type == "matches"; } bool isNotMatches() const { return type == "notMatches"; } bool isAnyOf() const { return type == "anyOf"; } bool isAllOf() const { return type == "allOf"; } bool isNot() const { return type == "not"; } bool evaluate() const; // const std::optional constValue; // equals, notEquals std::optional lhs; std::optional rhs; // inList, notInList std::optional string; std::optional list; // matches, notMatches std::optional regex; using ConditionPtr = std::shared_ptr; // anyOf, allOf std::optional> conditions; // not std::optional condition; }; struct Output { std::optional shortProgress; std::optional verbosity; std::optional debug; std::optional outputOnFailure; std::optional quiet; std::optional outputLogFile; std::optional outputJUnitFile; std::optional labelSummary; std::optional subprojectSummary; std::optional maxPassedTestOutputSize; std::optional maxFailedTestOutputSize; std::optional testOutputTruncation; std::optional maxTestNameWidth; }; struct Filter { struct Include { std::optional name; std::optional label; std::optional useUnion; struct Index { std::optional start; std::optional end; std::optional stride; std::optional> specificTests; }; std::optional index; }; struct Exclude { std::optional name; std::optional label; struct Fixtures { std::optional any; std::optional setup; std::optional cleanup; }; std::optional fixtures; }; std::optional include; std::optional exclude; }; struct Execution { std::optional stopOnFailure; std::optional enableFailover; std::optional jobs; std::optional resourceSpecFile; std::optional testLoad; std::optional showOnly; struct Repeat { QString mode; int count; }; std::optional repeat; std::optional interactiveDebugging; std::optional scheduleRandom; std::optional timeout; std::optional noTestsAction; }; class ConfigurePreset { public: void inheritFrom(const ConfigurePreset &other); QString name; Utils::FilePath fileDir; bool hidden = false; std::optional inherits; std::optional condition; std::optional vendor; std::optional displayName; std::optional description; std::optional generator; std::optional architecture; std::optional toolset; std::optional toolchainFile; std::optional binaryDir; std::optional installDir; std::optional cmakeExecutable; std::optional cacheVariables; std::optional environment; std::optional warnings; std::optional errors; std::optional debug; }; class BuildPreset { public: void inheritFrom(const BuildPreset &other); QString name; Utils::FilePath fileDir; bool hidden = false; std::optional inherits; std::optional condition; std::optional vendor; std::optional displayName; std::optional description; std::optional environment; std::optional configurePreset; bool inheritConfigureEnvironment = true; std::optional jobs; std::optional targets; std::optional configuration; std::optional verbose; std::optional cleanFirst; std::optional nativeToolOptions; }; class TestPreset { public: void inheritFrom(const TestPreset &other); QString name; bool hidden = false; Utils::FilePath fileDir; std::optional inherits; std::optional condition; std::optional vendor; std::optional displayName; std::optional description; std::optional environment; std::optional configurePreset; bool inheritConfigureEnvironment = true; std::optional configuration; std::optional overwriteConfigurationFile; std::optional output; std::optional filter; std::optional execution; }; } // namespace PresetsDetails class PresetsData { public: int version = 0; bool havePresets = false; bool hasValidPresets = true; QVersionNumber cmakeMinimimRequired; std::optional vendor; std::optional include; Utils::FilePath fileDir; QList configurePresets; QList buildPresets; QList testPresets; }; class PresetsParser { PresetsData m_presetsData; public: bool parse(Utils::FilePath const &jsonFile, QString &errorMessage, int &errorLine); const PresetsData &presetsData() const; }; } // CMakeProjectManager::Internal