Skip to content

Commit

Permalink
Add license checking support to bazel (#108)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored Oct 31, 2023
1 parent 7b3da59 commit 36172b7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
13 changes: 12 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_ROOT",
"GZ_VISIBILITY",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)
load("@rules_license//rules:license.bzl", "license")

package(
default_applicable_licenses = [GZ_ROOT + "utils:license"],
default_visibility = GZ_VISIBILITY,
features = GZ_FEATURES,
)

license(
name = "license",
package_name = "gz-utils",
)

licenses(["notice"])

exports_files(["LICENSE"])
Expand Down Expand Up @@ -39,8 +47,8 @@ gz_include_header(
name = "utilshh_genrule",
out = "include/gz/utils.hh",
hdrs = public_headers_no_gen + [
"include/gz/utils/config.hh",
"include/gz/utils/Export.hh",
"include/gz/utils/config.hh",
],
)

Expand All @@ -54,6 +62,7 @@ cc_library(
name = "utils",
srcs = ["src/Environment.cc"],
hdrs = public_headers,
copts = ["-fexceptions"],
includes = ["include"],
)

Expand All @@ -72,6 +81,7 @@ cc_library(

cc_test(
name = "ImplPtr_TEST",
size = "small",
srcs = ["test/integration/implptr/ImplPtr_TEST.cc"],
deps = [
":implptr_test_classes",
Expand All @@ -93,6 +103,7 @@ cc_test(
cc_test(
name = "NeverDestroyed_TEST",
srcs = ["src/NeverDestroyed_TEST.cc"],
copts = ["-fexceptions"],
deps = [
":utils",
"@gtest",
Expand Down
17 changes: 16 additions & 1 deletion cli/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_ROOT",
"GZ_VISIBILITY",
)
load("@rules_license//rules:license.bzl", "license")

package(
default_applicable_licenses = [GZ_ROOT + "utils/cli:license"],
)

license(
name = "license",
package_name = "gz-utils-cli",
)

public_headers = [
"include/gz/utils/cli/GzFormatter.hpp",
Expand All @@ -12,10 +23,14 @@ public_headers = [
cc_library(
name = "cli",
hdrs = public_headers,
copts = ["-fexceptions"],
includes = [
"include",
"include/external-cli",
],
visibility = GZ_VISIBILITY,
deps = ["@cli11"],
deps = [
GZ_ROOT + "utils:utils",
"@cli11"
],
)

0 comments on commit 36172b7

Please sign in to comment.