Skip to content

Commit 391846d

Browse files
authored
add rust codegen (#241)
1 parent 47b619e commit 391846d

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

BUILD.bazel

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,24 @@ bzlws_copy(
5454
strip_filepath_prefix = "external/{BAZEL_LABEL_WORKSPACE_NAME}",
5555
)
5656

57+
# keep sorted
58+
_plugins = [
59+
"@ecsact_lang_cpp//cpp_header_codegen:ecsact_cpp_header_codegen_bin",
60+
"@ecsact_lang_cpp//cpp_meta_header_codegen:ecsact_cpp_meta_header_codegen_bin",
61+
"@ecsact_lang_cpp//cpp_systems_header_codegen:ecsact_cpp_systems_header_codegen_bin",
62+
"@ecsact_lang_cpp//cpp_systems_source_codegen:ecsact_cpp_systems_source_codegen_bin",
63+
"@ecsact_lang_cpp//systems_header_codegen:ecsact_systems_header_codegen_bin",
64+
"@ecsact_lang_csharp//csharp_codegen:ecsact_csharp_codegen_bin",
65+
"@ecsact_lang_json//json_codegen:ecsact_json_codegen_bin",
66+
]
67+
5768
bzlws_copy(
5869
name = "copy_dist_codegen_plugins",
59-
srcs = [
60-
"@ecsact_lang_cpp//cpp_header_codegen:ecsact_cpp_header_codegen_bin",
61-
"@ecsact_lang_cpp//cpp_meta_header_codegen:ecsact_cpp_meta_header_codegen_bin",
62-
"@ecsact_lang_cpp//cpp_systems_header_codegen:ecsact_cpp_systems_header_codegen_bin",
63-
"@ecsact_lang_cpp//cpp_systems_source_codegen:ecsact_cpp_systems_source_codegen_bin",
64-
"@ecsact_lang_cpp//systems_header_codegen:ecsact_systems_header_codegen_bin",
65-
"@ecsact_lang_csharp//csharp_codegen:ecsact_csharp_codegen_bin",
66-
"@ecsact_lang_json//json_codegen:ecsact_json_codegen_bin",
67-
],
70+
srcs = select({
71+
"@platforms//os:windows": _plugins + ["@ecsact_rust_codegen_windows//file"],
72+
"@platforms//os:linux": _plugins + ["@ecsact_rust_codegen_linux//file"],
73+
"//conditions:default": _plugins,
74+
}),
6875
out = "dist/share/ecsact/plugins/{BAZEL_LABEL_NAME}[:-4].{EXTNAME}",
6976
force = True,
7077
)

WORKSPACE.bazel

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
workspace(name = "ecsact_sdk")
22

3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
44

55
_NLOHMANN_JSON_BUILD_FILE = """
66
load("@rules_cc//cc:defs.bzl", "cc_library")
@@ -115,6 +115,20 @@ http_archive(
115115
url = "https://github.com/ecsact-dev/ecsact_lang_csharp/archive/cb983ebd02b0437ce69711f09b7d4a1175b1eea2.zip",
116116
)
117117

118+
http_file(
119+
name = "ecsact_rust_codegen_windows",
120+
sha256 = "d35c8226f4953faf2d527d295c41adefd3215c61bad6f709e8ac812919c07daf",
121+
url = "https://github.com/ecsact-dev/ecsact_lang_rust/releases/download/0.1.0/ecsact_rust_codegen_bin.dll",
122+
downloaded_file_path = "ecsact_rust_codegen.dll",
123+
)
124+
125+
http_file(
126+
name = "ecsact_rust_codegen_linux",
127+
sha256 = "cac4856b63217960b4194812119def5f9a7126483533cc24e847abe66a120536",
128+
url = "https://github.com/ecsact-dev/ecsact_lang_rust/releases/download/0.1.0/ecsact_rust_codegen_bin.so",
129+
downloaded_file_path = "ecsact_rust_codegen.so",
130+
)
131+
118132
http_archive(
119133
name = "ecsact_lsp_server",
120134
sha256 = "a9f78d470a4346a13540b064f1a0f2c873a384d671e26b343778bbcc9716d52f",
@@ -139,9 +153,9 @@ http_archive(
139153

140154
http_archive(
141155
name = "bzlws",
142-
sha256 = "fbc78cd288e06bec4ab51bf05a185261968b8459f00ad667711005b26fb956b9",
143-
strip_prefix = "bzlws-096d6b4f3ecf3443dec05b9fe55442b3fdc92d38",
144-
url = "https://github.com/zaucy/bzlws/archive/096d6b4f3ecf3443dec05b9fe55442b3fdc92d38.zip",
156+
sha256 = "312b04b13dfcb77c283a5b9d411a5b24d886bea9bd513b6e2bb7c355566c974b",
157+
strip_prefix = "bzlws-3dcd03ed6a1be7099f65fd514c9a3efed800d0a0",
158+
url = "https://github.com/zaucy/bzlws/archive/3dcd03ed6a1be7099f65fd514c9a3efed800d0a0.zip",
145159
)
146160

147161
load("@bzlws//:repo.bzl", "bzlws_deps")

0 commit comments

Comments
 (0)