71 lines
2.8 KiB
C++
71 lines
2.8 KiB
C++
|
|
import std;
|
||
|
|
import Crafter.Build;
|
||
|
|
namespace fs = std::filesystem;
|
||
|
|
using namespace Crafter;
|
||
|
|
|
||
|
|
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
|
||
|
|
constexpr std::array<std::string_view, 6> networkInterfaces = {
|
||
|
|
"interfaces/Crafter.Network",
|
||
|
|
"interfaces/Crafter.Network-ClientTCP",
|
||
|
|
"interfaces/Crafter.Network-ListenerTCP",
|
||
|
|
"interfaces/Crafter.Network-ClientHTTP",
|
||
|
|
"interfaces/Crafter.Network-ListenerHTTP",
|
||
|
|
"interfaces/Crafter.Network-HTTP",
|
||
|
|
};
|
||
|
|
constexpr std::array<std::string_view, 4> networkImplementations = {
|
||
|
|
"implementations/Crafter.Network-ClientTCP",
|
||
|
|
"implementations/Crafter.Network-ListenerTCP",
|
||
|
|
"implementations/Crafter.Network-ClientHTTP",
|
||
|
|
"implementations/Crafter.Network-ListenerHTTP",
|
||
|
|
};
|
||
|
|
|
||
|
|
std::vector<std::string> depArgs(args.begin(), args.end());
|
||
|
|
Configuration* thread = GitProject({
|
||
|
|
.source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Thread.git" },
|
||
|
|
.args = depArgs,
|
||
|
|
});
|
||
|
|
|
||
|
|
Configuration cfg;
|
||
|
|
cfg.path = "./";
|
||
|
|
cfg.name = "Crafter.Network";
|
||
|
|
cfg.outputName = "Crafter.Network";
|
||
|
|
cfg.type = ConfigurationType::LibraryStatic;
|
||
|
|
ApplyStandardArgs(cfg, args);
|
||
|
|
cfg.dependencies = { thread };
|
||
|
|
{
|
||
|
|
std::array<fs::path, 6> ifaces;
|
||
|
|
std::ranges::copy(networkInterfaces, ifaces.begin());
|
||
|
|
std::array<fs::path, 4> impls;
|
||
|
|
std::ranges::copy(networkImplementations, impls.begin());
|
||
|
|
cfg.GetInterfacesAndImplementations(ifaces, impls);
|
||
|
|
}
|
||
|
|
|
||
|
|
auto addTest = [&](std::string name, fs::path implFile) {
|
||
|
|
Test t;
|
||
|
|
t.config.path = "./";
|
||
|
|
t.config.name = std::move(name);
|
||
|
|
t.config.outputName = t.config.name;
|
||
|
|
t.config.target = cfg.target;
|
||
|
|
t.config.debug = cfg.debug;
|
||
|
|
t.config.march = cfg.march;
|
||
|
|
t.config.mtune = cfg.mtune;
|
||
|
|
t.config.type = ConfigurationType::Executable;
|
||
|
|
t.config.dependencies = { thread };
|
||
|
|
std::array<fs::path, 6> ifaces;
|
||
|
|
std::ranges::copy(networkInterfaces, ifaces.begin());
|
||
|
|
std::array<fs::path, 5> impls;
|
||
|
|
std::ranges::copy(networkImplementations, impls.begin());
|
||
|
|
impls[4] = std::move(implFile);
|
||
|
|
t.config.GetInterfacesAndImplementations(ifaces, impls);
|
||
|
|
cfg.tests.push_back(std::move(t));
|
||
|
|
};
|
||
|
|
|
||
|
|
addTest("ShouldCompile", "tests/ShouldCompile");
|
||
|
|
addTest("ShouldRecieveHTTP", "tests/ShouldRecieveHTTP");
|
||
|
|
addTest("ShouldSendHTTP", "tests/ShouldSendHTTP");
|
||
|
|
addTest("ShouldSendRecieveHTTP", "tests/ShouldSendRecieveHTTP");
|
||
|
|
addTest("ShouldSendRecieveKeepaliveHTTP", "tests/ShouldSendRecieveKeepaliveHTTP");
|
||
|
|
addTest("ShouldSendRecieveLargeHTTP", "tests/ShouldSendRecieveLargeHTTP");
|
||
|
|
|
||
|
|
return cfg;
|
||
|
|
}
|