2022-03-18 23:17:22 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Error.h>
|
|
|
|
#include <AK/JsonObject.h>
|
|
|
|
#include <AK/Optional.h>
|
|
|
|
#include <AK/OwnPtr.h>
|
|
|
|
#include <LibCore/Object.h>
|
|
|
|
|
|
|
|
namespace HackStudio {
|
|
|
|
|
|
|
|
class ProjectConfig {
|
|
|
|
public:
|
2022-12-04 18:02:33 +00:00
|
|
|
static ErrorOr<NonnullOwnPtr<ProjectConfig>> try_load_project_config(DeprecatedString path);
|
2022-03-18 23:17:22 +01:00
|
|
|
static NonnullOwnPtr<ProjectConfig> create_empty();
|
|
|
|
|
|
|
|
ProjectConfig(JsonObject);
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
Optional<DeprecatedString> build_command() const { return read_key("build_command"); }
|
|
|
|
Optional<DeprecatedString> run_command() const { return read_key("run_command"); }
|
2022-03-18 23:17:22 +01:00
|
|
|
|
|
|
|
private:
|
2022-12-04 18:02:33 +00:00
|
|
|
Optional<DeprecatedString> read_key(DeprecatedString key_name) const;
|
2022-03-18 23:17:22 +01:00
|
|
|
|
|
|
|
JsonObject m_config;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|