-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bazel: Support bazel build for essential modules (#559)
* Bazel build for essential modules --------- Signed-off-by: Evgeny Petrov <[email protected]>
- Loading branch information
1 parent
fb24707
commit dfcd077
Showing
27 changed files
with
827 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
workspace.yaml | ||
.vscode/ | ||
/bazel-* | ||
/modules/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
filegroup( | ||
name = "types", | ||
srcs = glob(["types/**/*.yaml"]), | ||
name = "errors", | ||
srcs = glob(["errors/**/*.yaml"]), | ||
) | ||
|
||
filegroup( | ||
name = "interfaces", | ||
srcs = glob(["interfaces/**/*.yaml"]), | ||
exports_files(["dependencies.yaml"]) | ||
|
||
_GENERATED = { | ||
"third-party/bazel/deps_versions.bzl": "//third-party/bazel:deps_versions.bzl.new", | ||
} | ||
|
||
write_file( | ||
name = "gen_update", | ||
out = "update.sh", | ||
content = [ | ||
"#!/bin/sh", | ||
"set -xe", | ||
"cd $BUILD_WORKSPACE_DIRECTORY", | ||
] + [ | ||
"cp -fv bazel-bin/{1} {0} && chmod u+w {0}".format( | ||
k, v[2:].replace(":", "/") | ||
) | ||
for k, v in _GENERATED.items() | ||
] | ||
) | ||
|
||
filegroup( | ||
name = "errors", | ||
srcs = glob(["errors/**/*.yaml"]), | ||
sh_binary( | ||
name = "update", | ||
srcs = [":gen_update"], | ||
data = _GENERATED.values(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
interface_srcs = glob(["*.yaml"]) | ||
interface_names = [name[:-5] for name in interface_srcs] | ||
cpp_headers = [ | ||
"generated/interfaces/{}/Implementation.hpp".format(name) for name in interface_names | ||
] + [ | ||
"generated/interfaces/{}/Interface.hpp".format(name) for name in interface_names | ||
] + [ | ||
"generated/interfaces/{}/Types.hpp".format(name) for name in interface_names | ||
] | ||
|
||
# This separate label we need to resolve path to | ||
# the directory later in the genrule | ||
some_output = cpp_headers[0] | ||
|
||
filegroup( | ||
name = "interfaces", | ||
srcs = interface_srcs, | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
genrule( | ||
name = "cpp-headers", | ||
outs = cpp_headers, | ||
srcs = interface_srcs + [ | ||
"@everest-framework//schemas:schemas", | ||
"//types:types", | ||
"//:errors", | ||
], | ||
tools = [ | ||
"@everest-utils//ev-dev-tools:ev-cli", | ||
], | ||
cmd = """ | ||
$(location @everest-utils//ev-dev-tools:ev-cli) interface generate-headers \ | ||
--everest-dir . \ | ||
--schemas-dir external/everest-framework/schemas \ | ||
--disable-clang-format \ | ||
--output-dir `dirname $(location {some_output})`/.. | ||
""".format( | ||
some_output = some_output | ||
) | ||
) | ||
|
||
cc_library( | ||
name = "interfaces_lib", | ||
hdrs = [":cpp-headers"], | ||
visibility = ["//visibility:public"], | ||
includes = ["."], | ||
deps = [ | ||
"//types:types_lib", | ||
], | ||
copts = ["-std=c++17"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cc_library( | ||
name = "nanopb", | ||
srcs = glob(["nanopb/*.c"]), | ||
hdrs = glob(["nanopb/*.h"]), | ||
includes = ["."], | ||
include_prefix = "everest/3rd_party", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cc_library( | ||
name = "gpio", | ||
srcs = ["gpio.cpp"], | ||
hdrs = ["gpio.hpp"], | ||
visibility = ["//visibility:public"], | ||
includes = ["."], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("//modules:module.bzl", "cc_everest_module") | ||
|
||
cc_library( | ||
name = "auth_handler", | ||
srcs = glob(["lib/*.cpp"]), | ||
hdrs = glob(["include/*.hpp"]), | ||
strip_include_prefix = "include", | ||
deps = [ | ||
"@libtimer//:libtimer", | ||
"//third-party/bazel:boost_asio", | ||
"@everest-framework//:framework", | ||
"@com_github_HowardHinnant_date//:date", | ||
"//types:types_lib", | ||
], | ||
copts = ["-std=c++17"], | ||
) | ||
|
||
IMPLS = [ | ||
"main", | ||
"reservation", | ||
] | ||
|
||
cc_everest_module( | ||
name = "Auth", | ||
deps = [ | ||
"@libtimer//:libtimer", | ||
":auth_handler", | ||
], | ||
impls = IMPLS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("//modules:module.bzl", "cc_everest_module") | ||
|
||
IMPLS = [ | ||
"main", | ||
] | ||
|
||
cc_everest_module( | ||
name = "EnergyManager", | ||
deps = [ | ||
], | ||
impls = IMPLS, | ||
srcs = glob( | ||
[ | ||
"*.cpp", | ||
"*.hpp", | ||
], | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
load("//modules:module.bzl", "cc_everest_module") | ||
|
||
IMPLS = [ | ||
"energy_grid", | ||
"evse", | ||
"token_provider", | ||
"random_delay", | ||
] | ||
|
||
cc_everest_module( | ||
name = "EvseManager", | ||
deps = [ | ||
"@pugixml//:libpugixml", | ||
"@sigslot//:sigslot", | ||
], | ||
impls = IMPLS, | ||
srcs = glob( | ||
[ | ||
"*.cpp", | ||
"*.hpp", | ||
], | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
load("//modules:module.bzl", "cc_everest_module") | ||
|
||
IMPLS = [ | ||
"main", | ||
] | ||
|
||
cc_everest_module( | ||
name = "GenericPowermeter", | ||
deps = [], | ||
impls = IMPLS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("//modules:module.bzl", "cc_everest_module") | ||
|
||
IMPLS = [ | ||
"main", | ||
] | ||
|
||
cc_library( | ||
name = "libsqlite3_stub", | ||
linkopts = ["-lsqlite3"], | ||
) | ||
|
||
cc_everest_module( | ||
name = "PersistentStore", | ||
deps = [ | ||
":libsqlite3_stub", | ||
], | ||
impls = IMPLS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
load("//modules:module.bzl", "cc_everest_module") | ||
|
||
IMPLS = [ | ||
"main", | ||
] | ||
|
||
cc_everest_module( | ||
name = "SerialCommHub", | ||
deps = [ | ||
"//lib/staging/gpio", | ||
], | ||
impls = IMPLS, | ||
srcs = glob(["*.cpp", "*.hpp"]), | ||
) |
Oops, something went wrong.