Skip to content

Commit

Permalink
Refactor BuildInfo.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 446175132
  • Loading branch information
buildbreaker2021 authored and copybara-github committed May 3, 2022
1 parent 5a6b1a8 commit 0714a16
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 102 deletions.
40 changes: 0 additions & 40 deletions tools/cpp/bazel_build_info_translation_helper.cc

This file was deleted.

42 changes: 0 additions & 42 deletions tools/cpp/bazel_build_info_translation_helper.h

This file was deleted.

18 changes: 18 additions & 0 deletions tools/cpp/build_info_entry_set.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 The Bazel Authors. All rights reserved.
//
// 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
//
// http://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.

#ifndef BAZEL_TOOLS_CPP_BUILD_INFO_ENTRY_SET_H_
#define BAZEL_TOOLS_CPP_BUILD_INFO_ENTRY_SET_H_

#endif // BAZEL_TOOLS_CPP_BUILD_INFO_ENTRY_SET_H_
2 changes: 0 additions & 2 deletions tools/cpp/build_info_translation_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ absl::Status BuildInfoTranslationHelper::ParseVersionFile(
return BuildInfoTranslationHelper::ParseFile(version_file_path_, file_map);
}

BuildInfoTranslationHelper::~BuildInfoTranslationHelper() {}

} // namespace cpp
} // namespace tools
} // namespace bazel
13 changes: 0 additions & 13 deletions tools/cpp/build_info_translation_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,6 @@ class BuildInfoTranslationHelper {
absl::Status ParseVersionFile(
std::unordered_map<std::string, std::string>& file_map);

enum KeyType {
STRING = 0,
INTEGER = 1,
};

using KeyMap = std::unordered_map<
std::string, std::pair<KeyType, std::pair<std::string, std::string> > >;

virtual KeyMap getStableKeys() = 0;
virtual KeyMap getVolatileKeys() = 0;

virtual ~BuildInfoTranslationHelper() = 0;

private:
std::string info_file_path_;
std::string version_file_path_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "tools/cpp/bazel_build_info_translation_helper.h"
#include "tools/cpp/build_info_translation_helper.h"

#include "googletest/include/gtest/gtest.h"

Expand All @@ -25,7 +25,7 @@ static const char kTestFilePrefix[] = "";
class BuildInfoTranslationHelperTest : public testing::Test {};

TEST_F(BuildInfoTranslationHelperTest, CorrectFileFormat) {
BazelBuildInfoTranslationHelper helper = BazelBuildInfoTranslationHelper(
BuildInfoTranslationHelper helper = BuildInfoTranslationHelper(
absl::StrCat(kTestFilePrefix,
"bazel/tools/cpp/test_data/correct_file_format.txt"),
"");
Expand All @@ -43,7 +43,7 @@ TEST_F(BuildInfoTranslationHelperTest, CorrectFileFormat) {
}

TEST_F(BuildInfoTranslationHelperTest, NonExistingFile) {
BazelBuildInfoTranslationHelper helper = BazelBuildInfoTranslationHelper(
BuildInfoTranslationHelper helper = BuildInfoTranslationHelper(
"",
absl::StrCat(kTestFilePrefix,
"bazel/tools/cpp/test_data/this_file_does_not_exist.txt"));
Expand All @@ -60,7 +60,7 @@ TEST_F(BuildInfoTranslationHelperTest, NonExistingFile) {
}

TEST_F(BuildInfoTranslationHelperTest, DuplicatedKey) {
BazelBuildInfoTranslationHelper helper = BazelBuildInfoTranslationHelper(
BuildInfoTranslationHelper helper = BuildInfoTranslationHelper(
absl::StrCat(kTestFilePrefix,
"bazel/tools/cpp/test_data/duplicated_key.txt"),
"");
Expand All @@ -75,7 +75,7 @@ TEST_F(BuildInfoTranslationHelperTest, DuplicatedKey) {
}

TEST_F(BuildInfoTranslationHelperTest, MissingSeparator) {
BazelBuildInfoTranslationHelper helper = BazelBuildInfoTranslationHelper(
BuildInfoTranslationHelper helper = BuildInfoTranslationHelper(
"", absl::StrCat(kTestFilePrefix,
"bazel/tools/cpp/test_data/no_separator.txt"));
absl::Status expected_version_status =
Expand Down

0 comments on commit 0714a16

Please sign in to comment.