Skip to content

Commit b97c452

Browse files
seaubotzaucy
andauthored
chore: sync with ecsact_common (#216)
Co-authored-by: seaubot <[email protected]> Co-authored-by: Ezekiel Warren <[email protected]>
1 parent 31ab9de commit b97c452

23 files changed

+212
-184
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.1
1+
7.1.2

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+

.github/workflows/main.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,31 @@
44
name: main
55

66
on:
7-
push:
8-
branches:
9-
- "**"
7+
pull_request:
8+
merge_group:
109

1110
jobs:
11+
typos-check:
12+
name: Typos Check
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: crate-ci/[email protected]
17+
1218
formatting-check:
1319
name: Formatting Check
1420
runs-on: ubuntu-latest
1521
steps:
1622
- uses: actions/checkout@v4
17-
- uses: jidicula/[email protected]
18-
with: { clang-format-version: "16" }
23+
- uses: greut/eclint-action@v0
24+
- uses: jidicula/[email protected]
25+
with: { clang-format-version: "18" }
1926

2027
test-windows:
28+
if: github.event_name == 'merge_group'
2129
runs-on: windows-latest
2230
steps:
23-
- uses: actions/cache@v3
31+
- uses: actions/cache@v4
2432
with:
2533
path: |
2634
/Users/runneradmin/AppData/Local/bazelisk
@@ -33,9 +41,10 @@ jobs:
3341
working-directory: test
3442

3543
test-linux:
44+
if: github.event_name == 'merge_group'
3645
runs-on: ubuntu-latest
3746
steps:
38-
- uses: actions/cache@v3
47+
- uses: actions/cache@v4
3948
with:
4049
path: |
4150
~/.cache/bazelisk

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ All notable changes to this project will be documented in this file. See [conven
100100

101101
- - -
102102

103-
Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto).
103+
Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto).

bazel/common.bazelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ build --enable_runfiles
1010
build --noincompatible_remove_rule_name_parameter
1111
query --noincompatible_remove_rule_name_parameter
1212

13-
# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged
14-
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
15-
1613
common:ci --announce_rc
1714
common:ci --verbose_failures
1815
common:ci --keep_going

cog.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pre_bump_hooks = [
22
# Ecsact pre 1.0.0 the 0.X.0 is our 'major' version
33
"buildozer 'set version {{version}}' 'set compatibility_level {{version.minor}}' //MODULE.bazel:%module",
4+
"bazel mod tidy",
45
]
56

67
post_bump_hooks = [

ecsact/interpret/detail/file_eval_error.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace ecsact::detail {
99

1010
void check_file_eval_error(
11-
ecsact_eval_error& inout_error,
11+
ecsact_eval_error& in_out_error,
1212
ecsact_package_id package_id,
1313
ecsact_parse_status status,
1414
const ecsact_statement& statement,

ecsact/interpret/eval.cc

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ static auto statement_param( //
8989
template<>
9090
auto statement_param<int32_t>( //
9191
const ecsact_statement& statement,
92-
std::string_view param_name
92+
std::string_view in_param_name
9393
) -> std::optional<int32_t> {
9494
auto result = std::optional<int32_t>{};
9595
for(auto& param : view_statement_params(statement)) {
96-
if(std::string_view{param.name.data, static_cast<size_t>(param.name.length)} != param_name) {
96+
auto param_name =
97+
std::string_view{param.name.data, static_cast<size_t>(param.name.length)};
98+
if(param_name != in_param_name) {
9799
continue;
98100
}
99101

@@ -114,7 +116,10 @@ auto statement_param<bool>( //
114116
) -> std::optional<bool> {
115117
auto result = std::optional<bool>{};
116118
for(auto& param : view_statement_params(statement)) {
117-
if(std::string_view{param.name.data, static_cast<size_t>(param.name.length)} != param_name) {
119+
if(std::string_view{
120+
param.name.data,
121+
static_cast<size_t>(param.name.length)
122+
} != param_name) {
118123
continue;
119124
}
120125

@@ -727,7 +732,11 @@ static ecsact_eval_error eval_system_statement(
727732
return err;
728733
}
729734

730-
if(auto err = allow_statement_params(statement, context, std::array{"lazy"sv, "parallel"sv})) {
735+
if(auto err = allow_statement_params(
736+
statement,
737+
context,
738+
std::array{"lazy"sv, "parallel"sv}
739+
)) {
731740
return *err;
732741
}
733742

@@ -802,7 +811,8 @@ static ecsact_eval_error eval_action_statement(
802811
return err;
803812
}
804813

805-
if(auto err = allow_statement_params(statement, context, std::array{"parallel"sv})) {
814+
if(auto err =
815+
allow_statement_params(statement, context, std::array{"parallel"sv})) {
806816
return *err;
807817
}
808818

@@ -1757,13 +1767,13 @@ void ecsact_eval_reset() {
17571767
}
17581768

17591769
void ecsact::detail::check_file_eval_error(
1760-
ecsact_eval_error& inout_error,
1770+
ecsact_eval_error& in_out_error,
17611771
ecsact_package_id package_id,
17621772
ecsact_parse_status status,
17631773
const ecsact_statement& statement,
17641774
const std::string& source
17651775
) {
1766-
assert(inout_error.code == ECSACT_EVAL_OK);
1776+
assert(in_out_error.code == ECSACT_EVAL_OK);
17671777

17681778
if(status.code == ECSACT_PARSE_STATUS_BLOCK_END) {
17691779
if(statement.type == ECSACT_STATEMENT_ACTION) {
@@ -1776,8 +1786,8 @@ void ecsact::detail::check_file_eval_error(
17761786

17771787
auto caps = ecsact::meta::system_capabilities(*act_id);
17781788
if(caps.empty()) {
1779-
inout_error.code = ECSACT_EVAL_ERR_NO_CAPABILITIES;
1780-
inout_error.relevant_content = {
1789+
in_out_error.code = ECSACT_EVAL_ERR_NO_CAPABILITIES;
1790+
in_out_error.relevant_content = {
17811791
.data = source.c_str(),
17821792
.length = static_cast<int32_t>(source.size()),
17831793
};

renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"extends": [
44
"github>ecsact-dev/renovate-config"
55
]
6-
}
6+
}

test/comment_before_package.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
2-
#include "gtest/gtest.h"
3-
#include "ecsact/interpret/eval.h"
4-
5-
#include "test_lib.hh"
6-
7-
TEST(NoPackageStatementFirst, NoPackageStatementFirst) {
8-
auto errs = ecsact_interpret_test_files({"comment_before_package.ecsact"});
9-
ASSERT_EQ(errs.size(), 0) //
10-
<< "Expected no errors. Instead got: " << errs[0].error_message << "\n";
11-
}
1+
2+
#include "gtest/gtest.h"
3+
#include "ecsact/interpret/eval.h"
4+
5+
#include "test_lib.hh"
6+
7+
TEST(NoPackageStatementFirst, NoPackageStatementFirst) {
8+
auto errs = ecsact_interpret_test_files({"comment_before_package.ecsact"});
9+
ASSERT_EQ(errs.size(), 0) //
10+
<< "Expected no errors. Instead got: " << errs[0].error_message << "\n";
11+
}

test/comment_before_package.ecsact

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Comments are allowed before the package statement
2-
3-
package test.comment_before_package;
4-
1+
// Comments are allowed before the package statement
2+
3+
package test.comment_before_package;
4+
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include "gtest/gtest.h"
2-
#include "ecsact/interpret/eval.h"
3-
4-
#include "test_lib.hh"
5-
6-
TEST(NoPackageStatementFirst, NoPackageStatementFirst) {
7-
auto errs =
8-
ecsact_interpret_test_files({"errors/no_package_statement_first.ecsact"});
9-
ASSERT_EQ(errs.size(), 1);
10-
ASSERT_EQ(errs[0].eval_error, ECSACT_EVAL_ERR_EXPECTED_PACKAGE_STATEMENT);
11-
}
1+
#include "gtest/gtest.h"
2+
#include "ecsact/interpret/eval.h"
3+
4+
#include "test_lib.hh"
5+
6+
TEST(NoPackageStatementFirst, NoPackageStatementFirst) {
7+
auto errs =
8+
ecsact_interpret_test_files({"errors/no_package_statement_first.ecsact"});
9+
ASSERT_EQ(errs.size(), 1);
10+
ASSERT_EQ(errs[0].eval_error, ECSACT_EVAL_ERR_EXPECTED_PACKAGE_STATEMENT);
11+
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
component ExampleComponent {
2-
f32 num;
3-
}
4-
5-
// Package statement must be first
6-
package errors.no_pkg_statement_first;
7-
1+
component ExampleComponent {
2+
f32 num;
3+
}
4+
5+
// Package statement must be first
6+
package errors.no_pkg_statement_first;
7+
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include "gtest/gtest.h"
2-
#include "ecsact/interpret/eval.h"
3-
4-
#include "test_lib.hh"
5-
6-
TEST(InterpretError, UnknownAssociationField) {
7-
auto errs =
8-
ecsact_interpret_test_files({"errors/unknown_association_field.ecsact"});
9-
ASSERT_EQ(errs.size(), 1);
10-
ASSERT_EQ(errs[0].eval_error, ECSACT_EVAL_ERR_FIELD_NAME_ALREADY_EXISTS);
11-
}
1+
#include "gtest/gtest.h"
2+
#include "ecsact/interpret/eval.h"
3+
4+
#include "test_lib.hh"
5+
6+
TEST(InterpretError, UnknownAssociationField) {
7+
auto errs =
8+
ecsact_interpret_test_files({"errors/unknown_association_field.ecsact"});
9+
ASSERT_EQ(errs.size(), 1);
10+
ASSERT_EQ(errs[0].eval_error, ECSACT_EVAL_ERR_FIELD_NAME_ALREADY_EXISTS);
11+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package unknown_association_field;
2-
3-
component ComponentWithAssoc {
4-
entity foo;
5-
}
6-
7-
system MySystem {
8-
readwrite ComponentWithAssoc with bar {
9-
readwrite ComponentWithAssoc;
10-
}
11-
}
12-
1+
package unknown_association_field;
2+
3+
component ComponentWithAssoc {
4+
entity foo;
5+
}
6+
7+
system MySystem {
8+
readwrite ComponentWithAssoc with bar {
9+
readwrite ComponentWithAssoc;
10+
}
11+
}
12+

test/extra/extra.cc

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
#include "gtest/gtest.h"
2-
#include "ecsact/interpret/eval.h"
3-
#include "ecsact/runtime/meta.hh"
4-
5-
#include "test_lib.hh"
6-
7-
TEST(MultiPkgTest, NoErrors) {
8-
auto errs = ecsact_interpret_test_files({
9-
"extra/imported_pkg.ecsact",
10-
"extra/runtime_test.ecsact",
11-
});
12-
EXPECT_EQ(errs.size(), 0) //
13-
<< "Expected no errors. Instead got: " << errs[0].error_message << "\n";
14-
15-
EXPECT_EQ(ecsact_meta_count_packages(), 2);
16-
17-
auto pkg_ids = ecsact::meta::get_package_ids();
18-
for(auto pkg_id : pkg_ids) {
19-
auto pkg_name = ecsact::meta::package_name(pkg_id);
20-
21-
if(pkg_name == "runtime_test") {
22-
EXPECT_EQ(ecsact_meta_count_dependencies(pkg_id), 1) //
23-
<< "Expected main package to have 3 dependencies. One for each import";
24-
} else if(pkg_name == "imported.test_pkg") {
25-
} else {
26-
EXPECT_TRUE(false) << "No tests for package: " << pkg_name;
27-
}
28-
}
29-
}
1+
#include "gtest/gtest.h"
2+
#include "ecsact/interpret/eval.h"
3+
#include "ecsact/runtime/meta.hh"
4+
5+
#include "test_lib.hh"
6+
7+
TEST(MultiPkgTest, NoErrors) {
8+
auto errs = ecsact_interpret_test_files({
9+
"extra/imported_pkg.ecsact",
10+
"extra/runtime_test.ecsact",
11+
});
12+
EXPECT_EQ(errs.size(), 0) //
13+
<< "Expected no errors. Instead got: " << errs[0].error_message << "\n";
14+
15+
EXPECT_EQ(ecsact_meta_count_packages(), 2);
16+
17+
auto pkg_ids = ecsact::meta::get_package_ids();
18+
for(auto pkg_id : pkg_ids) {
19+
auto pkg_name = ecsact::meta::package_name(pkg_id);
20+
21+
if(pkg_name == "runtime_test") {
22+
EXPECT_EQ(ecsact_meta_count_dependencies(pkg_id), 1) //
23+
<< "Expected main package to have 3 dependencies. One for each import";
24+
} else if(pkg_name == "imported.test_pkg") {
25+
} else {
26+
EXPECT_TRUE(false) << "No tests for package: " << pkg_name;
27+
}
28+
}
29+
}

test/extra/imported_pkg.ecsact

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package imported.test_pkg;
2-
3-
component ImportedComponent {
4-
i32 num;
5-
}
6-
1+
package imported.test_pkg;
2+
3+
component ImportedComponent {
4+
i32 num;
5+
}
6+

0 commit comments

Comments
 (0)