Skip to content

Commit 2541d8f

Browse files
authored
moved async test to nested workspace (#132)
1 parent 8e343da commit 2541d8f

File tree

21 files changed

+150
-147
lines changed

21 files changed

+150
-147
lines changed

.bazelignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tests/serialize
1+
tests

.bazelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ build --incompatible_enable_cc_toolchain_resolution
55
build --incompatible_strict_action_env
66
build --enable_runfiles
77

8-
build:windows --platforms=//bazel/platforms:windows
9-
build:windows --host_platform=//bazel/platforms:windows
8+
build:windows --platforms=@ecsact_runtime//bazel/platforms:windows
9+
build:windows --host_platform=@ecsact_runtime//bazel/platforms:windows
1010

11-
build:linux --platforms=//bazel/platforms:linux
11+
build:linux --platforms=@ecsact_runtime//bazel/platforms:linux
1212
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
1313

1414
common:ci --announce_rc

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
key: ${{runner.os}}-bazel-cache
3030
- uses: actions/checkout@v3
3131
- run: bazel test --config=ci //...
32-
- run: cd tests/serialize
32+
- run: cd tests
3333
- run: bazel test --config=ci //...
3434

3535
test-linux:
@@ -43,7 +43,7 @@ jobs:
4343
key: ${{runner.os}}-bazel-cache
4444
- uses: actions/checkout@v3
4545
- run: bazel test --config=ci //...
46-
- run: cd tests/serialize
46+
- run: cd tests
4747
- run: bazel test --config=ci //...
4848

4949
check-module-headers:

BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exports_files([
1414
"ecsact/runtime/static.h",
1515
"ecsact/runtime.h",
1616
"codegen_plugin.bzl",
17+
"ecsact/codegen/ecsact_codegen_plugin_test.cc",
1718
"index.bzl",
1819
])
1920

@@ -96,7 +97,7 @@ cc_library(
9697
"ecsact/runtime/serialize.hh",
9798
],
9899
copts = copts,
99-
deps = [":common"],
100+
deps = [":common", ":core"],
100101
)
101102

102103
cc_library(

codegen_plugin.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def cc_ecsact_codegen_plugin(name = None, srcs = [], deps = [], defines = [], no
130130
if not no_validate_test:
131131
cc_test(
132132
name = "{}__validate".format(name),
133-
srcs = ["@ecsact_runtime//tests:ecsact_codegen_plugin_test.cc"],
133+
srcs = ["@ecsact_runtime//:ecsact/codegen/ecsact_codegen_plugin_test.cc"],
134134
args = ["$(rootpath :{}_bin)".format(name)],
135135
copts = _copts,
136136
data = [":{}_bin".format(name)],

ecsact/runtime/serialize.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <vector>
66
#include <type_traits>
77
#include "ecsact/runtime/serialize.h"
8+
#include "ecsact/runtime/core.h"
89

910
namespace ecsact {
1011

reference/async_reference/test/BUILD.bazel

Lines changed: 0 additions & 7 deletions
This file was deleted.

reference/async_reference/test/index.bzl

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import %workspace%/../../.bazelrc
1+
import %workspace%/../.bazelrc
22
try-import %workspace%/user.bazelrc
File renamed without changes.

tests/BUILD.bazel

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
load("@rules_cc//cc:defs.bzl", "cc_test")
2-
load("//bazel:copts.bzl", "copts")
3-
load("//:codegen_plugin.bzl", "cc_ecsact_codegen_plugin")
4-
5-
exports_files(
6-
["ecsact_codegen_plugin_test.cc"],
7-
visibility = ["//visibility:public"],
8-
)
2+
load("@ecsact_runtime//bazel:copts.bzl", "copts")
3+
load("@ecsact_runtime//:codegen_plugin.bzl", "cc_ecsact_codegen_plugin")
94

105
cc_ecsact_codegen_plugin(
116
name = "empty_codegen_plugin",
@@ -19,7 +14,7 @@ cc_test(
1914
srcs = ["test.cc"],
2015
copts = copts,
2116
deps = [
22-
"//:ecsact_runtime",
17+
"@ecsact_runtime",
2318
"@com_google_googletest//:gtest",
2419
"@com_google_googletest//:gtest_main",
2520
],
Lines changed: 88 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,88 @@
1-
workspace(name = "ecsact_runtime_serialize_test")
2-
3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4-
5-
http_archive(
6-
name = "bazel_skylib",
7-
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
8-
urls = [
9-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
10-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
11-
],
12-
)
13-
14-
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
15-
16-
bazel_skylib_workspace()
17-
18-
local_repository(
19-
name = "ecsact_runtime",
20-
path = "../../",
21-
)
22-
23-
http_archive(
24-
name = "ecsact_lang_cpp",
25-
sha256 = "2eb4456d0a706952bd46cff9cb6d1353a70d981e69eb42939da65b4c019ec610",
26-
strip_prefix = "ecsact_lang_cpp-23cb4156fb69a3e7e54a1093a91cd63a87a8abb2",
27-
url = "https://github.com/ecsact-dev/ecsact_lang_cpp/archive/23cb4156fb69a3e7e54a1093a91cd63a87a8abb2.zip",
28-
)
29-
30-
http_archive(
31-
name = "rules_ecsact",
32-
sha256 = "e6d888c63aa536b5b7c6af10d217cdb8ad98b2262fa9d02515a99edbd0d94eea",
33-
strip_prefix = "rules_ecsact-0.2.1",
34-
url = "https://github.com/ecsact-dev/rules_ecsact/archive/refs/tags/0.2.1.tar.gz",
35-
)
36-
37-
load("@rules_ecsact//ecsact:repositories.bzl", "ecsact_register_toolchains", "rules_ecsact_dependencies")
38-
39-
rules_ecsact_dependencies()
40-
41-
ecsact_register_toolchains()
42-
43-
http_archive(
44-
name = "com_google_googletest",
45-
sha256 = "ca6c78876bd052a7730dd717ba083e7351e26b3cfa68c5e3babd1b9d9925402e",
46-
strip_prefix = "googletest-0e0d9feefab1b51aaab9dfd70132e93c0b6964e5",
47-
url = "https://github.com/google/googletest/archive/0e0d9feefab1b51aaab9dfd70132e93c0b6964e5.zip",
48-
)
49-
50-
http_archive(
51-
name = "hedron_compile_commands",
52-
sha256 = "4b251a482a85de6c5cb0dc34c5671e73190b9ff348e9979fa2c033d81de0f928",
53-
strip_prefix = "bazel-compile-commands-extractor-5bb5ff2f32d542a986033102af771aa4206387b9",
54-
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/5bb5ff2f32d542a986033102af771aa4206387b9.tar.gz",
55-
)
56-
57-
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
58-
59-
hedron_compile_commands_setup()
1+
# NOTE: This workspace file is only necessary to prevent a cyclic dependency
2+
# between ecsact_rt_entt and this repository. Once a reference runtime
3+
# is built we can remove this nested workspace.
4+
# https://github.com/ecsact-dev/ecsact_runtime/issues/32
5+
workspace(name = "ecsact_runtime_tests")
6+
7+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
8+
9+
http_archive(
10+
name = "bazel_skylib",
11+
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
12+
urls = [
13+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
14+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
15+
],
16+
)
17+
18+
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
19+
20+
bazel_skylib_workspace()
21+
22+
local_repository(
23+
name = "ecsact_runtime",
24+
path = "..",
25+
)
26+
27+
http_archive(
28+
name = "boost",
29+
sha256 = "4a79c389add7e3d54d0e12c83098d471d24536ba2d6b8593d3a95f151f25eebb",
30+
strip_prefix = "boost-da62319c330d81ef032517cbe13b6f35d97387cb",
31+
urls = ["https://github.com/bazelboost/boost/archive/da62319c330d81ef032517cbe13b6f35d97387cb.zip"],
32+
)
33+
34+
load("@boost//:index.bzl", "boost_http_archives")
35+
36+
boost_http_archives()
37+
38+
http_archive(
39+
name = "ecsact_rt_entt",
40+
sha256 = "",
41+
strip_prefix = "ecsact_rt_entt-440fa3f35ad9a19ce86f8280dc3e751945b4ee42",
42+
url = "https://github.com/ecsact-dev/ecsact_rt_entt/archive/440fa3f35ad9a19ce86f8280dc3e751945b4ee42.zip",
43+
)
44+
45+
http_archive(
46+
name = "com_github_skypjack_entt",
47+
sha256 = "f7031545130bfc06f5fe6b2f8c87dcbd4c1254fab86657e2788b70dfeea57965",
48+
strip_prefix = "entt-3.10.1",
49+
url = "https://github.com/skypjack/entt/archive/refs/tags/v3.10.1.tar.gz",
50+
)
51+
52+
http_archive(
53+
name = "ecsact_lang_cpp",
54+
sha256 = "2eb4456d0a706952bd46cff9cb6d1353a70d981e69eb42939da65b4c019ec610",
55+
strip_prefix = "ecsact_lang_cpp-23cb4156fb69a3e7e54a1093a91cd63a87a8abb2",
56+
url = "https://github.com/ecsact-dev/ecsact_lang_cpp/archive/23cb4156fb69a3e7e54a1093a91cd63a87a8abb2.zip",
57+
)
58+
59+
http_archive(
60+
name = "rules_ecsact",
61+
sha256 = "e6d888c63aa536b5b7c6af10d217cdb8ad98b2262fa9d02515a99edbd0d94eea",
62+
strip_prefix = "rules_ecsact-0.2.1",
63+
url = "https://github.com/ecsact-dev/rules_ecsact/archive/refs/tags/0.2.1.tar.gz",
64+
)
65+
66+
load("@rules_ecsact//ecsact:repositories.bzl", "ecsact_register_toolchains", "rules_ecsact_dependencies")
67+
68+
rules_ecsact_dependencies()
69+
70+
ecsact_register_toolchains()
71+
72+
http_archive(
73+
name = "com_google_googletest",
74+
sha256 = "ca6c78876bd052a7730dd717ba083e7351e26b3cfa68c5e3babd1b9d9925402e",
75+
strip_prefix = "googletest-0e0d9feefab1b51aaab9dfd70132e93c0b6964e5",
76+
url = "https://github.com/google/googletest/archive/0e0d9feefab1b51aaab9dfd70132e93c0b6964e5.zip",
77+
)
78+
79+
http_archive(
80+
name = "hedron_compile_commands",
81+
sha256 = "4b251a482a85de6c5cb0dc34c5671e73190b9ff348e9979fa2c033d81de0f928",
82+
strip_prefix = "bazel-compile-commands-extractor-5bb5ff2f32d542a986033102af771aa4206387b9",
83+
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/5bb5ff2f32d542a986033102af771aa4206387b9.tar.gz",
84+
)
85+
86+
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
87+
88+
hedron_compile_commands_setup()

tests/async/BUILD.bazel

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_test")
2+
load("@rules_ecsact//ecsact:defs.bzl", "ecsact_codegen")
3+
load("@ecsact_runtime//bazel:copts.bzl", "copts")
4+
load("@ecsact_rt_entt//runtime:index.bzl", "ecsact_entt_runtime")
5+
6+
ecsact_entt_runtime(
7+
name = "async_test_core_module_runtime",
8+
srcs = ["async_test.ecsact"],
9+
ECSACT_ENTT_RUNTIME_PACKAGE = "::async_test::package",
10+
ECSACT_ENTT_RUNTIME_USER_HEADER = "async_test.ecsact.meta.hh",
11+
system_impls = ["dynamic"],
12+
)
13+
14+
ecsact_codegen(
15+
name = "async_test_support_generated_headers",
16+
srcs = ["async_test.ecsact"],
17+
plugins = [
18+
"@ecsact//codegen_plugins:cpp_header",
19+
"@ecsact//codegen_plugins:cpp_systems_header",
20+
"@ecsact//codegen_plugins:systems_header",
21+
"@ecsact//codegen_plugins:cpp_systems_source",
22+
"@ecsact_runtime//reference/serialize_reference/codegen",
23+
],
24+
)
25+
26+
cc_test(
27+
name = "async",
28+
copts = copts,
29+
srcs = [
30+
"async_ref_test.cc",
31+
":async_test_support_generated_headers",
32+
"@ecsact_runtime//reference/async_reference:async_reference.cc",
33+
"@ecsact_runtime//reference/async_reference:async_reference.hh",
34+
"@ecsact_runtime//reference/async_reference:async.cc",
35+
],
36+
deps = [
37+
":async_test_core_module_runtime",
38+
"@ecsact_runtime//:core",
39+
"@ecsact_runtime//:async",
40+
"@ecsact_runtime//:dynamic",
41+
"@ecsact_runtime//reference/async_reference:async",
42+
"@com_google_googletest//:gtest",
43+
"@com_google_googletest//:gtest_main",
44+
"@ecsact_runtime//reference/serialize_reference",
45+
],
46+
)

tests/serialize/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load("@rules_cc//cc:defs.bzl", "cc_test")
22
load("@rules_ecsact//ecsact:defs.bzl", "ecsact_codegen")
3-
load("//bazel:copts.bzl", "copts")
3+
load("@ecsact_runtime//bazel:copts.bzl", "copts")
44

55
ecsact_codegen(
66
name = "serialize_test_generated",

tests/serialize/bazel/BUILD.bazel

Whitespace-only changes.

tests/serialize/bazel/copts.bzl

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/serialize/bazel/platforms/BUILD.bazel

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/serialize/serialize_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "gtest/gtest.h"
22
#include <vector>
33
#include "ecsact/runtime/serialize.hh"
4-
#include "serialize_test_generated/serialize_test.ecsact.hh"
4+
#include "serialize/serialize_test_generated/serialize_test.ecsact.hh"
55

66
TEST(Serialize, Correctness) {
77
auto comp = serialize_test::ExampleComponent{};

0 commit comments

Comments
 (0)