threaded exception handling
Some checks failed
demo.yaml / threaded exception handling (push) Failing after 0s
Some checks failed
demo.yaml / threaded exception handling (push) Failing after 0s
This commit is contained in:
parent
598c666e91
commit
c2bb9023d4
14 changed files with 237 additions and 127 deletions
|
|
@ -21,22 +21,22 @@ export module Crafter.Build:Command;
|
|||
import std;
|
||||
|
||||
namespace Crafter {
|
||||
export struct CompileError {
|
||||
std::string filename;
|
||||
std::uint_fast32_t line;
|
||||
std::string message;
|
||||
std::string code;
|
||||
};
|
||||
// export struct CompileError {
|
||||
// std::string filename;
|
||||
// std::uint_fast32_t line;
|
||||
// std::string message;
|
||||
// std::string code;
|
||||
// };
|
||||
|
||||
export class CompileException : public std::exception {
|
||||
public:
|
||||
std::string message;
|
||||
std::vector<CompileError> errors;
|
||||
CompileException(std::vector<CompileError>&& errors);
|
||||
const char* what() const noexcept override;
|
||||
};
|
||||
// export class CompileException : public std::exception {
|
||||
// public:
|
||||
// std::string message;
|
||||
// std::vector<CompileError> errors;
|
||||
// CompileException(std::vector<CompileError>&& errors);
|
||||
// const char* what() const noexcept override;
|
||||
// };
|
||||
|
||||
export std::string RunCommand(const std::string_view cmd);
|
||||
export void RunCommandIgnore(const std::string_view cmd);
|
||||
export void RunClang(const std::string_view cmd);
|
||||
export std::string RunClang(const std::string_view cmd);
|
||||
}
|
||||
29
interfaces/Crafter.Build-CompileStatus.cppm
Normal file
29
interfaces/Crafter.Build-CompileStatus.cppm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Crafter® Build
|
||||
Copyright (C) 2025 Catcrafts®
|
||||
Catcrafts.net
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 3.0 as published by the Free Software Foundation;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
export module Crafter.Build:CompileStatus;
|
||||
import std;
|
||||
|
||||
namespace Crafter {
|
||||
export enum CompileStatus {
|
||||
CRAFTER_COMPILE_STATUS_WAITING,
|
||||
CRAFTER_COMPILE_STATUS_COMPLETED,
|
||||
CRAFTER_COMPILE_STATUS_ERROR
|
||||
};
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
|
||||
export module Crafter.Build:Implementation;
|
||||
import :CompileStatus;
|
||||
import std;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
|
|
@ -31,6 +32,6 @@ namespace Crafter {
|
|||
fs::path path;
|
||||
Implementation(fs::path&& path);
|
||||
bool Check(const fs::path& buildDir, const fs::path& pcmDir) const;
|
||||
void Compile(const std::string_view clang, const fs::path& buildDir) const;
|
||||
void Compile(const std::string_view clang, const fs::path& buildDir, std::string& result) const;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
|
||||
export module Crafter.Build:Module;
|
||||
import :CompileStatus;
|
||||
import std;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
|
|
@ -27,19 +28,19 @@ namespace Crafter {
|
|||
public:
|
||||
std::vector<Module*> moduleDependencies;
|
||||
std::vector<ModulePartition*> partitionDependencies;
|
||||
std::atomic<bool> compiled;
|
||||
std::atomic<CompileStatus> compiled;
|
||||
bool needsRecompiling;
|
||||
bool checked = false;
|
||||
std::string name;
|
||||
fs::path path;
|
||||
ModulePartition(std::string&& name, fs::path&& path);
|
||||
bool Check(const fs::path& pcmDir);
|
||||
void Compile(const std::string_view clang, const fs::path& pcmDir, const fs::path& buildDir);
|
||||
void Compile(const std::string_view clang, const fs::path& pcmDir, const fs::path& buildDir, std::string& result);
|
||||
};
|
||||
|
||||
export class Module {
|
||||
public:
|
||||
std::atomic<bool> compiled;
|
||||
std::atomic<CompileStatus> compiled;
|
||||
bool needsRecompiling;
|
||||
bool checked = false;
|
||||
std::vector<std::unique_ptr<ModulePartition>> partitions;
|
||||
|
|
@ -49,6 +50,6 @@ namespace Crafter {
|
|||
Module(std::string&& name, fs::path&& path);
|
||||
Module(std::string&& name, fs::path&& path, std::vector<std::unique_ptr<ModulePartition>>&& partitions);
|
||||
bool Check(const fs::path& pcmDir);
|
||||
void Compile(const std::string_view clang, const fs::path& pcmDir, const fs::path& buildDir);
|
||||
void Compile(const std::string_view clang, const fs::path& pcmDir, const fs::path& buildDir, std::string& result);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ import :Test;
|
|||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Crafter {
|
||||
export struct BuildResult {
|
||||
std::string errors;
|
||||
bool repack;
|
||||
};
|
||||
|
||||
export class Project {
|
||||
public:
|
||||
std::string name;
|
||||
|
|
@ -35,10 +40,10 @@ namespace Crafter {
|
|||
Project(std::string&& name, fs::path&& path, std::vector<Configuration>&& configurations);
|
||||
Project(std::string&& name, fs::path&& path, std::vector<Configuration>&& configurations, fs::path&& buildDir, fs::path&& binDir);
|
||||
static Project LoadFromJSON(const fs::path& path);
|
||||
Configuration& Build(std::string_view configuration);
|
||||
Configuration& Build(std::string_view configuration, const fs::path& binDir, const fs::path& outputDir, const fs::path& buildDir, std::string outputName);
|
||||
void Build(Configuration& configuration) const;
|
||||
void Build(Configuration& configuration, const fs::path& binDir, const fs::path& outputDir, const fs::path& buildDir, std::string outputName) const;
|
||||
std::tuple<Configuration&, BuildResult> Build(std::string_view configuration);
|
||||
std::tuple<Configuration&, BuildResult> Build(std::string_view configuration, const fs::path& binDir, const fs::path& outputDir, const fs::path& buildDir, std::string outputName);
|
||||
BuildResult Build(Configuration& configuration) const;
|
||||
BuildResult Build(Configuration& configuration, const fs::path& binDir, const fs::path& outputDir, const fs::path& buildDir, std::string outputName) const;
|
||||
TestResult RunTest(const std::string_view test);
|
||||
TestResult RunTest(Test& test) const;
|
||||
std::vector<TestResult> RunTests();
|
||||
|
|
|
|||
|
|
@ -24,4 +24,5 @@ export import :Module;
|
|||
export import :Configuration;
|
||||
export import :Shader;
|
||||
export import :Implementation;
|
||||
export import :Test;
|
||||
export import :Test;
|
||||
export import :CompileStatus;
|
||||
Loading…
Add table
Add a link
Reference in a new issue