Skip to content

Commit

Permalink
Build Utils examples in Bazel (#157)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored Nov 5, 2024
1 parent 10b3946 commit e5ebd74
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ cc_library(
srcs = ["src/Environment.cc"],
hdrs = ["include/gz/utils/Environment.hh"],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
":Config",
":Export",
Expand Down
9 changes: 2 additions & 7 deletions cli/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
load("@rules_license//rules:license.bzl", "license")

package(
default_applicable_licenses = ["//:license"],
)

license(
name = "license",
package_name = "gz-utils-cli",
default_visibility = ["__subpackages__"],
)

cc_library(
Expand All @@ -23,6 +17,7 @@ cc_library(
"include/gz/utils/cli/GzFormatter.hpp",
],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
"//:Export",
],
Expand Down
21 changes: 21 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package(
default_applicable_licenses = ["//:license"],
default_visibility = ["//visibility:private"],
)

cc_binary(
name = "log",
srcs = ["log/main.cc"],
deps = [
"//log:Logger",
],
)

cc_binary(
name = "using_cli",
srcs = ["using_cli/main.cc"],
deps = [
"//:Config",
"//cli",
],
)
10 changes: 4 additions & 6 deletions log/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
load("@rules_gazebo//gazebo:headers.bzl", "gz_export_header")
load("@rules_license//rules:license.bzl", "license")

package(
default_applicable_licenses = ["//:license"],
)

license(
name = "license",
package_name = "gz-utils-log",
default_visibility = ["__subpackages__"],
)

gz_export_header(
Expand All @@ -26,6 +21,7 @@ cc_library(
"include/gz/utils/log/SplitSink.hh",
],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [
":Export",
"//:Config",
Expand All @@ -43,6 +39,7 @@ cc_library(
"include/gz/utils/log/Logger.hh",
],
includes = ["include"],
visibility = ["//visibility:public"],
deps = [":SplitSink"],
)

Expand All @@ -58,6 +55,7 @@ cc_library(
cc_test(
name = "SplitSink_TEST",
srcs = ["src/SplitSink_TEST.cc"],
visibility = ["//visibility:public"],
deps = [
":log",
"@googletest//:gtest_main",
Expand Down

0 comments on commit e5ebd74

Please sign in to comment.