Skip to content

Commit 7ec3f04

Browse files
authored
feat: build subcommand (#13)
use `ecsact build` to build runtimes. This is a general replacement for `ecsact_rtb`. The report messages are in the same format as `ecsact_rtb` and we also introduced a new flag to filter what reports get reported.
1 parent fe508e9 commit 7ec3f04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3637
-830
lines changed

.bazelrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import %workspace%/bazel/common.bazelrc
22

3-
common [email protected]//:use_std_fs
4-
common --//:use_sdk_version
3+
build [email protected]//:use_std_fs
4+
query [email protected]//:use_std_fs
5+
build [email protected]//:use_std_fs
6+
query [email protected]//:use_std_fs
7+
build --//:use_sdk_version
8+
query --//:use_sdk_version
9+
510
build:windows --workspace_status_command=bazel/tools/wsc.cmd
611
build:linux --workspace_status_command=bazel/tools/wsc.sh
712

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ external
77

88
# ecsact codegen
99
*.ecsact.*
10+
11+
# test tmp dirs
12+
/test/build_recipe/tmp/

BUILD.bazel

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,28 @@
1-
load("@rules_cc//cc:defs.bzl", "cc_binary")
1+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
22
load("@rules_ecsact//ecsact:toolchain.bzl", "ecsact_toolchain")
33
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
4-
load("//bazel/tools:cc_stamp_header.bzl", "cc_stamp_header")
5-
load("//bazel:copts.bzl", "copts")
64

7-
package(default_visibility = ["//visibility:public"])
5+
package(default_visibility = ["//:__subpackages__"])
86

97
bool_flag(name = "use_sdk_version", build_setting_default = False)
108
config_setting(name = "use_sdk_version_enabled", flag_values = {":use_sdk_version": "true"})
119
config_setting(name = "use_sdk_version_disabled", flag_values = {":use_sdk_version": "false"})
1210

13-
cc_stamp_header(
14-
name = "bazel_stamp_header",
15-
out = "bazel_stamp_header.hh",
16-
)
17-
18-
cc_binary(
19-
name = "ecsact",
20-
srcs = [
21-
"ecsact_cli.cc",
22-
"bazel_stamp_header.hh",
23-
],
24-
defines = select({
25-
":use_sdk_version_enabled": ["ECSACT_CLI_USE_SDK_VERSION"],
26-
":use_sdk_version_disabled": [],
27-
}),
28-
copts = copts,
29-
stamp = 1,
30-
deps = [
31-
# "//commands:benchmark",
32-
"//commands:codegen",
33-
"//commands:command",
34-
"//commands:config",
35-
],
36-
)
37-
3811
alias(
3912
name = "ecsact_cli",
40-
actual = ":ecsact",
13+
visibility = ["//visibility:public"],
14+
actual = "//ecsact/cli:ecsact",
4115
)
4216

4317
ecsact_toolchain(
4418
name = "ecsact_toolchain",
45-
target_tool = ":ecsact",
19+
visibility = ["//visibility:public"],
20+
target_tool = ":ecsact_cli",
4621
)
4722

4823
toolchain(
4924
name = "toolchain",
25+
visibility = ["//visibility:public"],
5026
toolchain = ":ecsact_toolchain",
5127
toolchain_type = "@rules_ecsact//ecsact:toolchain_type",
5228
)

MODULE.bazel

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module(
44
compatibility_level = 2,
55
)
66

7-
bazel_dep(name = "nlohmann_json", version = "3.11.2")
87
bazel_dep(name = "rules_cc", version = "0.0.8")
8+
bazel_dep(name = "nlohmann_json", version = "3.11.2")
99
bazel_dep(name = "platforms", version = "0.0.7")
1010
bazel_dep(name = "rules_pkg", version = "0.9.1")
1111
bazel_dep(name = "bazel_skylib", version = "1.4.2")
@@ -16,4 +16,11 @@ bazel_dep(name = "ecsact_codegen", version = "0.1.2")
1616
bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2")
1717
bazel_dep(name = "magic_enum", version = "0.9.3")
1818
bazel_dep(name = "docopt.cpp", version = "0.6.2")
19-
bazel_dep(name = "rules_ecsact", version = "0.4.2")
19+
bazel_dep(name = "rules_ecsact", version = "0.4.5")
20+
bazel_dep(name = "boost.process", version = "1.83.0.bzl.2")
21+
bazel_dep(name = "yaml-cpp")
22+
git_override(
23+
module_name = "yaml-cpp",
24+
commit = "37f1b8b8c9e5172ff3a79a3d5fdbb87f2994842b",
25+
remote = "https://github.com/jbeder/yaml-cpp",
26+
)

bazel/common.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ query --noincompatible_remove_rule_name_parameter
1313

1414
# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged
1515
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
16+
build:linux --linkopt=-lc++experimental
1617

1718
common:ci --announce_rc
1819
common:ci --verbose_failures

bazel/copts.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ copts = selects.with_or({
66
"-std=c++20",
77
],
88
("@rules_cc//cc/compiler:clang"): [
9-
"-std=c++2b",
9+
"-std=c++20",
1010
"-fexperimental-library",
1111
],
1212
("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [
13-
"/std:c++latest",
13+
"/std:c++20",
1414
"/permissive-",
1515
"/Zc:preprocessor",
1616
],

ecsact/cli/BUILD.bazel

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library")
2+
load("//bazel/tools:cc_stamp_header.bzl", "cc_stamp_header")
3+
load("//bazel:copts.bzl", "copts")
4+
5+
package(default_visibility = ["//:__subpackages__"])
6+
7+
cc_library(
8+
name = "report_message",
9+
copts = copts,
10+
hdrs = ["report_message.hh"],
11+
)
12+
13+
cc_library(
14+
name = "report",
15+
copts = copts,
16+
hdrs = ["report.hh"],
17+
srcs = ["report.cc"],
18+
deps = [
19+
":report_message",
20+
],
21+
)
22+
23+
cc_stamp_header(
24+
name = "bazel_stamp_header",
25+
out = "bazel_stamp_header.hh",
26+
)
27+
28+
cc_binary(
29+
name = "ecsact",
30+
visibility = ["//visibility:public"],
31+
srcs = [
32+
"ecsact_cli.cc",
33+
"bazel_stamp_header.hh",
34+
],
35+
defines = select({
36+
"//:use_sdk_version_enabled": ["ECSACT_CLI_USE_SDK_VERSION"],
37+
"//:use_sdk_version_disabled": [],
38+
}),
39+
copts = copts,
40+
stamp = 1,
41+
deps = [
42+
# "//ecsact/cli/commands:benchmark",
43+
"//ecsact/cli/commands:codegen",
44+
"//ecsact/cli/commands:command",
45+
"//ecsact/cli/commands:config",
46+
"//ecsact/cli/commands:build",
47+
],
48+
)

commands/BUILD.bazel renamed to ecsact/cli/commands/BUILD.bazel

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cc_library(
1616
# copts = copts,
1717
# deps = [
1818
# ":command",
19-
# "//executable_path",
19+
# "//ecsact/cli/detail/executable_path",
2020
# "@magic_enum",
2121
# "@docopt.cpp//:docopt",
2222
# "@boost.dll",
@@ -35,7 +35,8 @@ cc_library(
3535
copts = copts,
3636
deps = [
3737
":command",
38-
"//executable_path",
38+
"//ecsact/cli/detail/executable_path",
39+
"//ecsact/cli/commands/codegen:codegen",
3940
"@magic_enum",
4041
"@docopt.cpp//:docopt",
4142
"@boost.dll",
@@ -54,8 +55,30 @@ cc_library(
5455
copts = copts,
5556
deps = [
5657
":command",
57-
"//executable_path",
58+
"//ecsact/cli/detail/executable_path",
5859
"@docopt.cpp//:docopt",
5960
"@nlohmann_json//:json",
6061
],
6162
)
63+
64+
cc_library(
65+
name = "build",
66+
srcs = ["build.cc"],
67+
hdrs = ["build.hh"],
68+
copts = copts,
69+
deps = [
70+
":command",
71+
"//ecsact/cli:report",
72+
"//ecsact/cli:report_message",
73+
"//ecsact/cli/detail:json_report",
74+
"//ecsact/cli/detail:text_report",
75+
"//ecsact/cli/detail/executable_path",
76+
"//ecsact/cli/commands/build/recipe:taste",
77+
"//ecsact/cli/commands/build/recipe:cook",
78+
"//ecsact/cli/commands/build:cc_compiler",
79+
"//ecsact/cli/commands/build:build_recipe",
80+
"@ecsact_interpret",
81+
"@docopt.cpp//:docopt",
82+
"@magic_enum",
83+
],
84+
)

0 commit comments

Comments
 (0)