Skip to content

Commit

Permalink
chore: remove rules_ecsact dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Mar 14, 2024
1 parent 4c3d26b commit 77fac19
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 174 deletions.
16 changes: 1 addition & 15 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_ecsact//ecsact:toolchain.bzl", "ecsact_toolchain")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

package(default_visibility = ["//:__subpackages__"])

Expand All @@ -13,16 +12,3 @@ alias(
visibility = ["//visibility:public"],
actual = "//ecsact/cli:ecsact",
)

ecsact_toolchain(
name = "ecsact_toolchain",
visibility = ["//visibility:public"],
target_tool = ":ecsact_cli",
)

toolchain(
name = "toolchain",
visibility = ["//visibility:public"],
toolchain = ":ecsact_toolchain",
toolchain_type = "@rules_ecsact//ecsact:toolchain_type",
)
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ bazel_dep(name = "ecsact_codegen", version = "0.1.2")
bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2")
bazel_dep(name = "magic_enum", version = "0.9.3")
bazel_dep(name = "docopt.cpp", version = "0.6.2")
bazel_dep(name = "rules_ecsact", version = "0.4.9")
bazel_dep(name = "boost.process", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.algorithm", version = "1.83.0.bzl.1")
bazel_dep(name = "toolchains_llvm", version = "0.10.3")
Expand Down
32 changes: 1 addition & 31 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ecsact/cli/commands/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ constexpr auto USAGE = R"docopt(Ecsact Build Command
// text : Human readable text format

auto ecsact::cli::detail::build_command( //
int argc,
char* argv[]
int argc,
const char* argv[]
) -> int {
auto args = docopt::docopt(USAGE, {argv + 1, argv + argc});
auto format = args["--format"].asString();
Expand Down
2 changes: 1 addition & 1 deletion ecsact/cli/commands/build.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace ecsact::cli::detail {

int build_command(int argc, char* argv[]);
int build_command(int argc, const char* argv[]);
static_assert(std::is_same_v<command_fn_t, decltype(&build_command)>);

} // namespace ecsact::cli::detail
2 changes: 1 addition & 1 deletion ecsact/cli/commands/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void file_write_fn(const char* str, int32_t str_len) {
file_write_stream << std::string_view(str, str_len);
}

int ecsact::cli::detail::codegen_command(int argc, char* argv[]) {
int ecsact::cli::detail::codegen_command(int argc, const char* argv[]) {
using namespace std::string_literals;

auto args = docopt::docopt(USAGE, {argv + 1, argv + argc});
Expand Down
13 changes: 12 additions & 1 deletion ecsact/cli/commands/codegen.hh
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
#pragma once

#include <type_traits>
#include <vector>
#include <string>

#include "./command.hh"

namespace ecsact::cli::detail {

int codegen_command(int argc, char* argv[]);
int codegen_command(int argc, const char* argv[]);
static_assert(std::is_same_v<command_fn_t, decltype(&codegen_command)>);

inline auto codegen_command(std::vector<std::string> args) -> int {
auto c_args = std::vector<const char*>();
c_args.reserve(args.size());
for(auto& arg : args) {
c_args.emplace_back(arg.c_str());
}
return codegen_command(c_args.size(), c_args.data());
}

} // namespace ecsact::cli::detail
2 changes: 1 addition & 1 deletion ecsact/cli/commands/command.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace ecsact::cli::detail {

using command_fn_t = int (*)(int argc, char* argv[]);
using command_fn_t = int (*)(int argc, const char* argv[]);

}
2 changes: 1 addition & 1 deletion ecsact/cli/commands/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ constexpr auto CANNOT_FIND_PLUGIN_DIR = R"(
https://github.com/ecsact-dev/ecsact_sdk/issues
)";

int ecsact::cli::detail::config_command(int argc, char* argv[]) {
int ecsact::cli::detail::config_command(int argc, const char* argv[]) {
using namespace std::string_literals;

auto args = docopt::docopt(USAGE, {argv + 1, argv + argc});
Expand Down
2 changes: 1 addition & 1 deletion ecsact/cli/commands/config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace ecsact::cli::detail {

int config_command(int argc, char* argv[]);
int config_command(int argc, const char* argv[]);
static_assert(std::is_same_v<command_fn_t, decltype(&config_command)>);

} // namespace ecsact::cli::detail
2 changes: 2 additions & 0 deletions test/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ build [email protected]//:use_std_fs
query [email protected]//:use_std_fs
query [email protected]//:use_std_fs

build --nocheck_visibility

try-import %workspace%/user.bazelrc
39 changes: 18 additions & 21 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@ecsact_cli//bazel:copts.bzl", "copts")
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_ecsact//ecsact:defs.bzl", "ecsact_codegen", "ecsact_codegen_plugin")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")

package(default_visibility = ["//:__subpackages__"])

cc_binary(
name = "test_codegen_plugin_bin",
name = "test_codegen_plugin",
linkshared = True,
copts = copts,
srcs = [
Expand All @@ -15,27 +13,26 @@ cc_binary(
],
deps = [
"@ecsact_codegen//:plugin",
"@ecsact_runtime//:dylib",
"@ecsact_runtime//dylib:meta",
"@ecsact_runtime//dylib:util",
],
defines = ["ECSACT_META_API_LOAD_AT_RUNTIME"],
)

ecsact_codegen_plugin(
name = "test_codegen_plugin",
plugin = ":test_codegen_plugin_bin",
output_extension = "txt",
)

ecsact_codegen(
name = "codegen_test",
output_directory = "_codegen_test",
srcs = ["test.ecsact"],
plugins = [":test_codegen_plugin"],
)

build_test(
name = "build_test",
targets = [
":codegen_test",
cc_test(
name = "test_codegen",
copts = copts,
srcs = ["test_codegen.cc"],
data = [
"test.ecsact",
":test_codegen_plugin",
],
deps = [
"@ecsact_interpret",
"@bazel_tools//tools/cpp/runfiles",
"@ecsact_cli//ecsact/cli/commands:codegen",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)
4 changes: 2 additions & 2 deletions test/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ bazel_dep(name = "ecsact_codegen", version = "0.1.3")
bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.process", version = "1.83.0.bzl.2")
bazel_dep(name = "ecsact_runtime", version = "0.5.1")
bazel_dep(name = "ecsact_interpret", version = "0.5.0")
bazel_dep(name = "toolchains_llvm", version = "0.10.3")
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "ecsact_cli")
bazel_dep(name = "yaml-cpp")

Expand All @@ -28,8 +30,6 @@ git_override(
commit = "204aa593e002cbd177d30f11f54cff3559110bb9",
)

register_toolchains("@ecsact_cli//:all")

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(llvm_version = "16.0.4")

Expand Down
Loading

0 comments on commit 77fac19

Please sign in to comment.