blob: 398523b486135c7f5303044f4d63e293390b1d79 [file] [log] [blame]
// Copyright 2022 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
package {
default_applicable_licenses: ["external_pigweed_license"],
}
cc_library_headers {
name: "pw_log_headers",
cpp_std: "c++2a",
vendor_available: true,
export_include_dirs: ["public"],
host_supported: true,
}
cc_library_headers {
name: "pw_log_pwpb_headers",
cpp_std: "c++2a",
vendor_available: true,
host_supported: true,
generated_headers: [
"google_protobuf_descriptor_pwpb_h",
"pw_log_log_proto_pwpb_h",
"pw_protobuf_protos_common_pwpb_h",
"pw_tokenizer_proto_options_pwpb_h",
],
export_generated_headers: [
"google_protobuf_descriptor_pwpb_h",
"pw_log_log_proto_pwpb_h",
"pw_protobuf_protos_common_pwpb_h",
"pw_tokenizer_proto_options_pwpb_h",
],
}
// Copies the proto files to a prefix directory to add the prefix to the
// compiled proto. The prefix is taken from the directory name of the first
// item listen in out.
genrule_defaults {
name: "pw_log_add_prefix_to_proto",
cmd: "out_files=($(out)); prefix=$$(dirname $${out_files[0]}); " +
"mkdir -p $${prefix}; cp -t $${prefix} $(in);"
}
genrule {
name: "pw_log_log_proto_with_prefix",
defaults: ["pw_log_add_prefix_to_proto"],
srcs: [
"log.proto",
],
out: [
"pw_log/proto/log.proto",
],
}
genrule {
name: "pw_log_log_proto_pwpb_h",
srcs: [":pw_log_log_proto_with_prefix",],
cmd: "python3 $(location pw_protobuf_compiler_py) " +
"--proto-path=external/pigweed/pw_protobuf/ " +
// Requires the generated pw_tokenizer/proto/options.proto filepath.
"--proto-path=$$(dirname $$(dirname $$(dirname $(location :pw_tokenizer_proto_options_proto)))) " +
"--proto-path=external/protobuf/src/ " +
"--out-dir=$$(dirname $(location pw_log/proto/log.pwpb.h)) " +
"--plugin-path=$(location pw_protobuf_plugin_py) " +
"--compile-dir=$$(dirname $(in)) " +
"--sources $(in) " +
"--language pwpb " +
"--no-experimental-proto3-optional " +
"--protoc=$(location aprotoc) ",
out: [
"pw_log/proto/log.pwpb.h",
],
tool_files: [
":pw_tokenizer_proto_options_proto",
],
tools: [
"aprotoc",
"pw_protobuf_plugin_py",
"pw_protobuf_compiler_py",
],
}
android_library {
name: "pw_log_android_java",
srcs: ["java/android_main/dev/pigweed/pw_log/*.java"],
visibility: ["//visibility:public"],
sdk_version: "current",
}