Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: greut/eclint-action@v0
- uses: jidicula/clang-format-action@v4.11.0
with: { clang-format-version: "19" }
- uses: jidicula/clang-format-action@v4.15.0
with: { clang-format-version: "20" }

test-windows:
if: >-
Expand Down
63 changes: 39 additions & 24 deletions ecsact/cli/commands/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,21 @@ static auto print_last_error_if_available(
stdout_json_benchmark_reporter& reporter
) -> bool {
if(!runtime.has("ecsactsi_wasm_last_error_message")) {
reporter.report(warning_message{
"Cannot get wasm error message because "
"'ecsactsi_wasm_last_error_message' is missing",
});
reporter.report(
warning_message{
"Cannot get wasm error message because "
"'ecsactsi_wasm_last_error_message' is missing",
}
);
return false;
}
if(!runtime.has("ecsactsi_wasm_last_error_message_length")) {
reporter.report(warning_message{
"Cannot get wasm error message because "
"'ecsactsi_wasm_last_error_message_length' is missing",
});
reporter.report(
warning_message{
"Cannot get wasm error message because "
"'ecsactsi_wasm_last_error_message_length' is missing",
}
);
return false;
}

Expand Down Expand Up @@ -406,9 +410,11 @@ auto start_async_benchmark(
async_evc.system_error_callback = //
[](ecsact_execute_systems_error err, void* user_data) {
auto vars_ptr = static_cast<decltype(&vars)>(user_data);
vars_ptr->reporter.report(error_message{
"System Execution Error: " + std::string(magic_enum::enum_name(err)),
});
vars_ptr->reporter.report(
error_message{
"System Execution Error: " + std::string(magic_enum::enum_name(err)),
}
);
};

async_evc.async_error_callback_user_data = &vars;
Expand All @@ -424,14 +430,19 @@ auto start_async_benchmark(

for(auto& req_id : req_ids) {
if(req_id == vars_ptr->connect_req_id) {
vars_ptr->reporter.report(error_message{
"Async connect failed: "s + std::string(magic_enum::enum_name(err)),
});
vars_ptr->reporter.report(
error_message{
"Async connect failed: "s +
std::string(magic_enum::enum_name(err)),
}
);
} else {
vars_ptr->reporter.report(error_message{
"Async error (req="s + std::to_string(static_cast<int>(req_id)) +
"): "s + std::string(magic_enum::enum_name(err)),
});
vars_ptr->reporter.report(
error_message{
"Async error (req="s + std::to_string(static_cast<int>(req_id)) +
"): "s + std::string(magic_enum::enum_name(err)),
}
);
}
}

Expand All @@ -450,9 +461,11 @@ auto start_async_benchmark(
for(auto req_id : req_ids) {
if(req_id == vars_ptr->connect_req_id) {
vars_ptr->connected = true;
vars_ptr->reporter.report(info_message{
"Async successfully connected",
});
vars_ptr->reporter.report(
info_message{
"Async successfully connected",
}
);
}
}
};
Expand Down Expand Up @@ -503,9 +516,11 @@ auto start_async_benchmark(
}

if(tick >= options.iterations) {
options.reporter.report(info_message{
"Async benchmark ended at tick " + std::to_string(tick),
});
options.reporter.report(
info_message{
"Async benchmark ended at tick " + std::to_string(tick),
}
);
break;
}
}
Expand Down
14 changes: 8 additions & 6 deletions ecsact/cli/commands/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ auto ecsact::cli::detail::build_command( //
if(!eval_errors.empty()) {
for(auto eval_error : eval_errors) {
auto err_source_path = file_paths[eval_error.source_index];
ecsact::cli::report(ecsact_error_message{
.ecsact_source_path = err_source_path.generic_string(),
.message = eval_error.error_message,
.line = eval_error.line,
.character = eval_error.character,
});
ecsact::cli::report(
ecsact_error_message{
.ecsact_source_path = err_source_path.generic_string(),
.message = eval_error.error_message,
.line = eval_error.line,
.character = eval_error.character,
}
);
}

return 1;
Expand Down
36 changes: 21 additions & 15 deletions ecsact/cli/commands/build/build_recipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,15 @@ static auto parse_sources( //
if(src["outdir"]) {
outdir = src["outdir"].as<std::string>();
}
result.emplace_back(source_fetch{
.url = fetch.as<std::string>(),
.integrity = integrity,
.strip_prefix = strip_prefix,
.outdir = outdir,
.paths = paths,
});
result.emplace_back(
source_fetch{
.url = fetch.as<std::string>(),
.integrity = integrity,
.strip_prefix = strip_prefix,
.outdir = outdir,
.paths = paths,
}
);
} else if(path) {
auto src_path = fs::path{path.as<std::string>()};
auto outdir = std::optional<std::string>{};
Expand All @@ -248,17 +250,21 @@ static auto parse_sources( //
src_path = src_path.lexically_normal();
}

result.emplace_back(source_path{
.path = src_path,
.outdir = outdir,
});
result.emplace_back(
source_path{
.path = src_path,
.outdir = outdir,
}
);
}
} else if(src.IsScalar()) {
auto path = fs::path{src.as<std::string>()}.lexically_normal();
result.emplace_back(source_path{
.path = path,
.outdir = ".",
});
result.emplace_back(
source_path{
.path = path,
.outdir = ".",
}
);
}
}

Expand Down
54 changes: 32 additions & 22 deletions ecsact/cli/commands/build/cc_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ static auto vsdevcmd_env_var(

auto subcommand_id =
static_cast<ecsact::cli::subcommand_id_t>(extract_script_proc.id());
ecsact::cli::report(subcommand_start_message{
.id = subcommand_id,
.executable = vsdevcmd_path.string(),
.arguments = {env_var_name},
});
ecsact::cli::report(
subcommand_start_message{
.id = subcommand_id,
.executable = vsdevcmd_path.string(),
.arguments = {env_var_name},
}
);

auto line = std::string{};
while(std::getline(std_is, line, ';')) {
Expand All @@ -146,19 +148,23 @@ static auto vsdevcmd_env_var(
while(std::getline(err_is, line)) {
boost::trim(line);
if(!line.empty()) {
ecsact::cli::report(ecsact::cli::subcommand_stderr_message{
.id = subcommand_id,
.line = line
});
ecsact::cli::report(
ecsact::cli::subcommand_stderr_message{
.id = subcommand_id,
.line = line
}
);
}
}

extract_script_proc.wait();

ecsact::cli::report(subcommand_end_message{
.id = subcommand_id,
.exit_code = extract_script_proc.exit_code(),
});
ecsact::cli::report(
subcommand_end_message{
.id = subcommand_id,
.exit_code = extract_script_proc.exit_code(),
}
);

return result;
}
Expand Down Expand Up @@ -235,21 +241,25 @@ static auto cc_vswhere( //

auto subcommand_id =
static_cast<ecsact::cli::subcommand_id_t>(vswhere_proc.id());
ecsact::cli::report(subcommand_start_message{
.id = subcommand_id,
.executable = vswhere->generic_string(),
.arguments = vswhere_proc_args,
});
ecsact::cli::report(
subcommand_start_message{
.id = subcommand_id,
.executable = vswhere->generic_string(),
.arguments = vswhere_proc_args,
}
);

auto vswhere_output = nlohmann::json::parse(vswhere_output_stream);

vswhere_proc.wait();
auto vswhere_exit_code = vswhere_proc.exit_code();

ecsact::cli::report(subcommand_end_message{
.id = subcommand_id,
.exit_code = vswhere_exit_code,
});
ecsact::cli::report(
subcommand_end_message{
.id = subcommand_id,
.exit_code = vswhere_exit_code,
}
);

if(!vswhere_output.is_array()) {
ecsact::cli::report_error(
Expand Down
23 changes: 13 additions & 10 deletions ecsact/cli/commands/build/recipe/cook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,8 @@ auto cl_compile(compile_options options) -> int {
src_compile_exit_code_futures.reserve(valid_srcs.size());

for(auto src : valid_srcs) {
src_compile_exit_code_futures
.emplace_back(std::async(std::launch::async, [&, src] {
src_compile_exit_code_futures.emplace_back(
std::async(std::launch::async, [&, src] {
auto src_cl_args = cl_args;
src_cl_args.push_back("/c");
src_cl_args.push_back(std::format("@{}", main_params_file.string()));
Expand All @@ -850,17 +850,20 @@ auto cl_compile(compile_options options) -> int {
src_cl_args.push_back("/std:c++20");
}

src_cl_args.push_back(std::format(
"/Fo{}\\", // typos:disable-line
long_path_workaround(intermediate_dir).string()
));
src_cl_args.push_back(
std::format(
"/Fo{}\\", // typos:disable-line
long_path_workaround(intermediate_dir).string()
)
);

return ecsact::cli::detail::spawn_and_report(
options.compiler.compiler_path,
src_cl_args,
reporter
);
}));
})
);
}

auto any_src_compile_failures = false;
Expand Down Expand Up @@ -890,9 +893,9 @@ auto cl_compile(compile_options options) -> int {
cl_args.push_back(obj_f.string());
}

auto obj_params_file =
create_params_file(long_path_workaround(options.work_dir / "object.params")
);
auto obj_params_file = create_params_file(
long_path_workaround(options.work_dir / "object.params")
);

cl_args.push_back("/Fo:"); // typos:disable-line
cl_args.push_back(
Expand Down
14 changes: 8 additions & 6 deletions ecsact/cli/commands/codegen/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ auto ecsact::cli::codegen(codegen_options options) -> int {
plugin.get<decltype(ecsact_dylib_has_fn)>("ecsact_dylib_has_fn");
}

auto dylib_set_fn_addr =
plugin.get<decltype(ecsact_dylib_set_fn_addr)>("ecsact_dylib_set_fn_addr"
);
auto dylib_set_fn_addr = plugin.get<decltype(ecsact_dylib_set_fn_addr)>(
"ecsact_dylib_set_fn_addr"
);

auto set_meta_fn_ptr = [&](const char* fn_name, auto fn_ptr) {
if(dylib_has_fn && !dylib_has_fn(fn_name)) {
Expand Down Expand Up @@ -258,9 +258,11 @@ auto ecsact::cli::codegen(codegen_options options) -> int {

if(options.only_print_output_files) {
for(auto& output_file_path : plugin_output_paths) {
report(output_path_message{
fs::weakly_canonical(output_file_path).generic_string()
});
report(
output_path_message{
fs::weakly_canonical(output_file_path).generic_string()
}
);
}
plugin.unload();
continue;
Expand Down
7 changes: 4 additions & 3 deletions ecsact/cli/commands/recipe-bundle/build_recipe_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,13 @@ auto ecsact::build_recipe_bundle::create( //
continue;
}

auto plugin_file_path =
cli::resolve_plugin_path(cli::resolve_plugin_path_options{
auto plugin_file_path = cli::resolve_plugin_path(
cli::resolve_plugin_path_options{
.plugin_arg = plugin,
.default_plugins_dir = recipe.base_directory(),
.additional_plugin_dirs = {recipe.base_directory()},
});
}
);

if(!plugin_file_path) {
return std::logic_error{
Expand Down
Loading
Loading