Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add license checking support to bazel #108

Merged
merged 11 commits into from
Oct 31, 2023
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"
],
)