Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 527024233
  • Loading branch information
A Googler authored and Blaze Rules Copybara committed Apr 25, 2023
1 parent 71c4fc6 commit 493169c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 26 deletions.
2 changes: 0 additions & 2 deletions proto/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

bzl_library(
name = "defs",
srcs = [
Expand Down
2 changes: 0 additions & 2 deletions proto/private/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

bzl_library(
name = "dependencies",
srcs = ["dependencies.bzl"],
Expand Down
2 changes: 0 additions & 2 deletions proto/private/rules/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

bzl_library(
name = "proto_descriptor_set",
srcs = [
Expand Down
2 changes: 0 additions & 2 deletions tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("//proto:defs.bzl", "proto_library")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

proto_library(
name = "empty_proto",
srcs = [
Expand Down
2 changes: 0 additions & 2 deletions tests/load_from_macro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//proto:defs.bzl", "proto_library")
load(":tags.bzl", "TAGS")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

proto_library(
name = "foo",
srcs = ["foo.proto"],
Expand Down
2 changes: 0 additions & 2 deletions tests/rules/proto_descriptor_set/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//proto:defs.bzl", "proto_descriptor_set", "proto_library")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

proto_library(
name = "empty_proto_library",
)
Expand Down
21 changes: 11 additions & 10 deletions tests/rules/proto_descriptor_set/proto_descriptor_set_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include <string>
#include <vector>

#include "google/protobuf/descriptor.proto.h"
#include "tools/cpp/runfiles/runfiles.h"
#include "google/protobuf/descriptor.pb.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "testing/base/public/gmock.h"
#include "tests/utils/workspace_constants.h"
#include "tools/cpp/runfiles/runfiles.h"

using bazel::tools::cpp::runfiles::Runfiles;
using google::protobuf::FileDescriptorProto;
Expand All @@ -34,7 +34,8 @@ namespace {

std::string GetRlocation(const std::string& file) {
static std::unique_ptr<Runfiles> runfiles(Runfiles::CreateForTest());
std::string path = runfiles->Rlocation(rulesproto::kWorkspaceRlocation + file);
std::string path =
runfiles->Rlocation(rulesproto::kWorkspaceRlocation + file);
std::ifstream input(path, std::ifstream::binary);
if (!input) {
path = runfiles->Rlocation(rulesproto::kWorkspaceRlocationBzlmod + file);
Expand All @@ -61,8 +62,8 @@ std::vector<std::string> ReadFileDescriptorSet(const std::string& path) {
unordered_proto_files.insert(file_descriptor.name());
}

std::vector<std::string> proto_files(
unordered_proto_files.begin(), unordered_proto_files.end());
std::vector<std::string> proto_files(unordered_proto_files.begin(),
unordered_proto_files.end());
std::sort(proto_files.begin(), proto_files.end());
return proto_files;
}
Expand All @@ -71,9 +72,9 @@ void AssertFileDescriptorSetContains(
const std::string& path,
const std::vector<std::string>& expected_proto_files) {
std::vector<std::string> actual_proto_files =
ReadFileDescriptorSet(
GetRlocation(path));
EXPECT_THAT(actual_proto_files, ::testing::IsSupersetOf(expected_proto_files));
ReadFileDescriptorSet(GetRlocation(path));
EXPECT_THAT(actual_proto_files,
::testing::IsSupersetOf(expected_proto_files));
}

} // namespace
Expand All @@ -89,7 +90,7 @@ TEST(ProtoDescriptorSetTest, WellKnownProtos) {
{
"google/protobuf/any.proto",
"google/protobuf/api.proto",
"google/protobuf/descriptor.proto",
"google/protobuf/descriptor.pb",
"google/protobuf/duration.proto",
"google/protobuf/empty.proto",
"google/protobuf/field_mask.proto",
Expand Down
2 changes: 0 additions & 2 deletions tests/utils/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

cc_library(
name = "workspace_constants",
testonly = True,
Expand Down
2 changes: 0 additions & 2 deletions tools/file_concat/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")

package(default_applicable_licenses = ["//third_party/bazel_rules/rules_proto:license"])

cc_binary(
name = "file_concat",
srcs = [
Expand Down

0 comments on commit 493169c

Please sign in to comment.