Renamed ApplicationConfig to ProjectConfig
This commit is contained in:
@@ -66,7 +66,7 @@ add_executable(Bloom
|
|||||||
src/Generated/resources.cpp
|
src/Generated/resources.cpp
|
||||||
|
|
||||||
# Project & application configuration
|
# Project & application configuration
|
||||||
src/ApplicationConfig.cpp
|
src/ProjectConfig.cpp
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
src/EventManager/EventListener.cpp
|
src/EventManager/EventListener.cpp
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ int Application::run(const std::vector<std::string>& arguments) {
|
|||||||
|
|
||||||
if (this->insightConfig.insightEnabled) {
|
if (this->insightConfig.insightEnabled) {
|
||||||
this->insight = std::make_unique<Insight>(this->eventManager);
|
this->insight = std::make_unique<Insight>(this->eventManager);
|
||||||
this->insight->setApplicationConfig(this->applicationConfig);
|
this->insight->setProjectConfig(this->projectConfig);
|
||||||
this->insight->setEnvironmentConfig(this->environmentConfig);
|
this->insight->setEnvironmentConfig(this->environmentConfig);
|
||||||
this->insight->setInsightConfig(this->insightConfig);
|
this->insight->setInsightConfig(this->insightConfig);
|
||||||
|
|
||||||
@@ -92,8 +92,8 @@ void Application::startup() {
|
|||||||
std::bind(&Application::onShutdownApplicationRequest, this, std::placeholders::_1)
|
std::bind(&Application::onShutdownApplicationRequest, this, std::placeholders::_1)
|
||||||
);
|
);
|
||||||
|
|
||||||
this->applicationConfig = this->extractConfig();
|
this->projectConfig = this->extractConfig();
|
||||||
Logger::configure(this->applicationConfig);
|
Logger::configure(this->projectConfig);
|
||||||
|
|
||||||
// Start signal handler
|
// Start signal handler
|
||||||
this->blockAllSignalsOnCurrentThread();
|
this->blockAllSignalsOnCurrentThread();
|
||||||
@@ -101,21 +101,21 @@ void Application::startup() {
|
|||||||
|
|
||||||
Logger::info("Selected environment: \"" + this->selectedEnvironmentName + "\"");
|
Logger::info("Selected environment: \"" + this->selectedEnvironmentName + "\"");
|
||||||
Logger::debug("Number of environments extracted from config: "
|
Logger::debug("Number of environments extracted from config: "
|
||||||
+ std::to_string(this->applicationConfig.environments.size()));
|
+ std::to_string(this->projectConfig.environments.size()));
|
||||||
|
|
||||||
// Validate the selected environment
|
// Validate the selected environment
|
||||||
if (!applicationConfig.environments.contains(this->selectedEnvironmentName)) {
|
if (!projectConfig.environments.contains(this->selectedEnvironmentName)) {
|
||||||
throw InvalidConfig("Environment (\"" + this->selectedEnvironmentName + "\") not found in configuration.");
|
throw InvalidConfig("Environment (\"" + this->selectedEnvironmentName + "\") not found in configuration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
this->environmentConfig = applicationConfig.environments.at(this->selectedEnvironmentName);
|
this->environmentConfig = projectConfig.environments.at(this->selectedEnvironmentName);
|
||||||
this->insightConfig = this->environmentConfig.insightConfig.value_or(this->applicationConfig.insightConfig);
|
this->insightConfig = this->environmentConfig.insightConfig.value_or(this->projectConfig.insightConfig);
|
||||||
|
|
||||||
if (this->environmentConfig.debugServerConfig.has_value()) {
|
if (this->environmentConfig.debugServerConfig.has_value()) {
|
||||||
this->debugServerConfig = this->environmentConfig.debugServerConfig.value();
|
this->debugServerConfig = this->environmentConfig.debugServerConfig.value();
|
||||||
|
|
||||||
} else if (this->applicationConfig.debugServerConfig.has_value()) {
|
} else if (this->projectConfig.debugServerConfig.has_value()) {
|
||||||
this->debugServerConfig = this->applicationConfig.debugServerConfig.value();
|
this->debugServerConfig = this->projectConfig.debugServerConfig.value();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw InvalidConfig("Debug server configuration missing.");
|
throw InvalidConfig("Debug server configuration missing.");
|
||||||
@@ -169,8 +169,8 @@ void Application::shutdown() {
|
|||||||
Thread::setThreadState(ThreadState::STOPPED);
|
Thread::setThreadState(ThreadState::STOPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationConfig Application::extractConfig() {
|
ProjectConfig Application::extractConfig() {
|
||||||
auto appConfig = ApplicationConfig();
|
auto appConfig = ProjectConfig();
|
||||||
auto currentPath = std::filesystem::current_path().string();
|
auto currentPath = std::filesystem::current_path().string();
|
||||||
auto jsonConfigFile = QFile(QString::fromStdString(currentPath + "/bloom.json"));
|
auto jsonConfigFile = QFile(QString::fromStdString(currentPath + "/bloom.json"));
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ int Application::initProject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::startTargetController() {
|
void Application::startTargetController() {
|
||||||
this->targetController.setApplicationConfig(this->applicationConfig);
|
this->targetController.setProjectConfig(this->projectConfig);
|
||||||
this->targetController.setEnvironmentConfig(this->environmentConfig);
|
this->targetController.setEnvironmentConfig(this->environmentConfig);
|
||||||
|
|
||||||
this->targetControllerThread = std::thread(
|
this->targetControllerThread = std::thread(
|
||||||
@@ -309,7 +309,7 @@ void Application::startDebugServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->debugServer = supportedDebugServers.at(this->debugServerConfig.name)();
|
this->debugServer = supportedDebugServers.at(this->debugServerConfig.name)();
|
||||||
this->debugServer->setApplicationConfig(this->applicationConfig);
|
this->debugServer->setProjectConfig(this->projectConfig);
|
||||||
this->debugServer->setEnvironmentConfig(this->environmentConfig);
|
this->debugServer->setEnvironmentConfig(this->environmentConfig);
|
||||||
this->debugServer->setDebugServerConfig(this->debugServerConfig);
|
this->debugServer->setDebugServerConfig(this->debugServerConfig);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "src/Insight/Insight.hpp"
|
#include "src/Insight/Insight.hpp"
|
||||||
|
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/VersionNumber.hpp"
|
#include "src/VersionNumber.hpp"
|
||||||
|
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
@@ -131,9 +131,9 @@ namespace Bloom
|
|||||||
/**
|
/**
|
||||||
* Configuration extracted from the user's project configuration file.
|
* Configuration extracted from the user's project configuration file.
|
||||||
*
|
*
|
||||||
* See ApplicationConfig.hpp for more on this.
|
* See ProjectConfig.hpp for more on this.
|
||||||
*/
|
*/
|
||||||
ApplicationConfig applicationConfig;
|
ProjectConfig projectConfig;
|
||||||
EnvironmentConfig environmentConfig;
|
EnvironmentConfig environmentConfig;
|
||||||
DebugServerConfig debugServerConfig;
|
DebugServerConfig debugServerConfig;
|
||||||
InsightConfig insightConfig;
|
InsightConfig insightConfig;
|
||||||
@@ -193,12 +193,12 @@ namespace Bloom
|
|||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts config from the user's JSON config file and generates an ApplicationConfig object.
|
* Extracts config from the user's JSON config file and generates an ProjectConfig object.
|
||||||
*
|
*
|
||||||
* @see ApplicationConfig declaration for more on this.
|
* @see ProjectConfig declaration for more on this.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static ApplicationConfig extractConfig();
|
static ProjectConfig extractConfig();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Presents application help text to user.
|
* Presents application help text to user.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "src/EventManager/Events/Events.hpp"
|
#include "src/EventManager/Events/Events.hpp"
|
||||||
#include "src/EventManager/EventManager.hpp"
|
#include "src/EventManager/EventManager.hpp"
|
||||||
#include "src/Exceptions/DebugServerInterrupted.hpp"
|
#include "src/Exceptions/DebugServerInterrupted.hpp"
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/Helpers/Thread.hpp"
|
#include "src/Helpers/Thread.hpp"
|
||||||
#include "src/Targets/TargetDescriptor.hpp"
|
#include "src/Targets/TargetDescriptor.hpp"
|
||||||
#include "src/Targets/TargetRegister.hpp"
|
#include "src/Targets/TargetRegister.hpp"
|
||||||
@@ -31,8 +31,8 @@ namespace Bloom::DebugServers
|
|||||||
explicit DebugServer(EventManager& eventManager): eventManager(eventManager) {};
|
explicit DebugServer(EventManager& eventManager): eventManager(eventManager) {};
|
||||||
virtual ~DebugServer() = default;
|
virtual ~DebugServer() = default;
|
||||||
|
|
||||||
void setApplicationConfig(const ApplicationConfig& applicationConfig) {
|
void setProjectConfig(const ProjectConfig& projectConfig) {
|
||||||
this->applicationConfig = applicationConfig;
|
this->projectConfig = projectConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
||||||
@@ -67,7 +67,7 @@ namespace Bloom::DebugServers
|
|||||||
*/
|
*/
|
||||||
std::shared_ptr<EventNotifier> interruptEventNotifier = nullptr;
|
std::shared_ptr<EventNotifier> interruptEventNotifier = nullptr;
|
||||||
|
|
||||||
ApplicationConfig applicationConfig;
|
ProjectConfig projectConfig;
|
||||||
EnvironmentConfig environmentConfig;
|
EnvironmentConfig environmentConfig;
|
||||||
DebugServerConfig debugServerConfig;
|
DebugServerConfig debugServerConfig;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "src/Targets/TargetState.hpp"
|
#include "src/Targets/TargetState.hpp"
|
||||||
#include "src/Targets/TargetRegister.hpp"
|
#include "src/Targets/TargetRegister.hpp"
|
||||||
#include "src/Targets/TargetMemory.hpp"
|
#include "src/Targets/TargetMemory.hpp"
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
|
|
||||||
namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "src/Helpers/Thread.hpp"
|
#include "src/Helpers/Thread.hpp"
|
||||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
|
|
||||||
#include "src/EventManager/EventManager.hpp"
|
#include "src/EventManager/EventManager.hpp"
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
@@ -49,8 +49,8 @@ namespace Bloom
|
|||||||
)
|
)
|
||||||
) {};
|
) {};
|
||||||
|
|
||||||
void setApplicationConfig(const ApplicationConfig& applicationConfig) {
|
void setProjectConfig(const ProjectConfig& projectConfig) {
|
||||||
this->applicationConfig = applicationConfig;
|
this->projectConfig = projectConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
||||||
@@ -71,7 +71,7 @@ namespace Bloom
|
|||||||
std::array<char*, 1> qtApplicationArgv = {this->qtApplicationName.data()};
|
std::array<char*, 1> qtApplicationArgv = {this->qtApplicationName.data()};
|
||||||
int qtApplicationArgc = 1;
|
int qtApplicationArgc = 1;
|
||||||
|
|
||||||
ApplicationConfig applicationConfig;
|
ProjectConfig projectConfig;
|
||||||
EnvironmentConfig environmentConfig;
|
EnvironmentConfig environmentConfig;
|
||||||
InsightConfig insightConfig;
|
InsightConfig insightConfig;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "src/Helpers/Thread.hpp"
|
#include "src/Helpers/Thread.hpp"
|
||||||
#include "src/Helpers/SyncSafe.hpp"
|
#include "src/Helpers/SyncSafe.hpp"
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/EventManager/EventManager.hpp"
|
#include "src/EventManager/EventManager.hpp"
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Targets/TargetState.hpp"
|
#include "src/Targets/TargetState.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
using namespace Bloom;
|
using namespace Bloom;
|
||||||
|
|
||||||
void Logger::configure(ApplicationConfig& applicationConfig) {
|
void Logger::configure(ProjectConfig& projectConfig) {
|
||||||
if (applicationConfig.debugLoggingEnabled) {
|
if (projectConfig.debugLoggingEnabled) {
|
||||||
Logger::debugPrintingEnabled = true;
|
Logger::debugPrintingEnabled = true;
|
||||||
Logger::debug("Debug log printing has been enabled.");
|
Logger::debug("Debug log printing has been enabled.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <QTimeZone>
|
#include <QTimeZone>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/Helpers/DateTime.hpp"
|
#include "src/Helpers/DateTime.hpp"
|
||||||
|
|
||||||
namespace Bloom
|
namespace Bloom
|
||||||
@@ -53,7 +53,7 @@ namespace Bloom
|
|||||||
class Logger
|
class Logger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void configure(ApplicationConfig& applicationConfig);
|
static void configure(ProjectConfig& projectConfig);
|
||||||
|
|
||||||
static void silence();
|
static void silence();
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "ApplicationConfig.hpp"
|
#include "ProjectConfig.hpp"
|
||||||
|
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
#include "src/Exceptions/InvalidConfig.hpp"
|
#include "src/Exceptions/InvalidConfig.hpp"
|
||||||
|
|
||||||
using namespace Bloom;
|
using namespace Bloom;
|
||||||
|
|
||||||
void ApplicationConfig::init(const QJsonObject& jsonObject) {
|
void ProjectConfig::init(const QJsonObject& jsonObject) {
|
||||||
if (!jsonObject.contains("environments")) {
|
if (!jsonObject.contains("environments")) {
|
||||||
throw Exceptions::InvalidConfig(
|
throw Exceptions::InvalidConfig(
|
||||||
"No environments found - please review the bloom.json configuration file and ensure that "
|
"No environments found - please review the bloom.json configuration file and ensure that "
|
||||||
@@ -16,7 +16,7 @@ namespace Bloom
|
|||||||
* can define multiple debugging environments, each object should be assigned a key in the config file. We use this
|
* can define multiple debugging environments, each object should be assigned a key in the config file. We use this
|
||||||
* key to allow users to select different debugging environments between debugging sessions.
|
* key to allow users to select different debugging environments between debugging sessions.
|
||||||
*
|
*
|
||||||
* On application startup, we extract the config from this JSON file and generate an ApplicationConfig object.
|
* On application startup, we extract the config from this JSON file and generate an ProjectConfig object.
|
||||||
* See Application::extractConfig() for more on this.
|
* See Application::extractConfig() for more on this.
|
||||||
*
|
*
|
||||||
* Some config parameters are specific to certain entities within Bloom, but have no significance across the
|
* Some config parameters are specific to certain entities within Bloom, but have no significance across the
|
||||||
@@ -174,9 +174,9 @@ namespace Bloom
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This holds all user provided application configuration.
|
* This holds all user provided project configuration.
|
||||||
*/
|
*/
|
||||||
struct ApplicationConfig
|
struct ProjectConfig
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Obtains config parameters from JSON object.
|
* Obtains config parameters from JSON object.
|
||||||
@@ -36,8 +36,8 @@ namespace Bloom
|
|||||||
public:
|
public:
|
||||||
explicit TargetController(EventManager& eventManager): eventManager(eventManager) {};
|
explicit TargetController(EventManager& eventManager): eventManager(eventManager) {};
|
||||||
|
|
||||||
void setApplicationConfig(const ApplicationConfig& applicationConfig) {
|
void setProjectConfig(const ProjectConfig& projectConfig) {
|
||||||
this->applicationConfig = applicationConfig;
|
this->projectConfig = projectConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
||||||
@@ -55,7 +55,7 @@ namespace Bloom
|
|||||||
*/
|
*/
|
||||||
TargetControllerState state = TargetControllerState::SUSPENDED;
|
TargetControllerState state = TargetControllerState::SUSPENDED;
|
||||||
|
|
||||||
ApplicationConfig applicationConfig;
|
ProjectConfig projectConfig;
|
||||||
EnvironmentConfig environmentConfig;
|
EnvironmentConfig environmentConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "src/Targets/Microchip/AVR/Target.hpp"
|
#include "src/Targets/Microchip/AVR/Target.hpp"
|
||||||
#include "src/Targets/TargetRegister.hpp"
|
#include "src/Targets/TargetRegister.hpp"
|
||||||
#include "src/DebugToolDrivers/DebugTool.hpp"
|
#include "src/DebugToolDrivers/DebugTool.hpp"
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/Exceptions/Exception.hpp"
|
#include "src/Exceptions/Exception.hpp"
|
||||||
|
|
||||||
#include "TargetParameters.hpp"
|
#include "TargetParameters.hpp"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "src/ApplicationConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
|
|
||||||
#include "TargetDescriptor.hpp"
|
#include "TargetDescriptor.hpp"
|
||||||
#include "TargetState.hpp"
|
#include "TargetState.hpp"
|
||||||
|
|||||||
Reference in New Issue
Block a user