From 885d333d5565b210c1abc120eeee8e84c14e186f Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 5 Nov 2024 14:51:09 +0100 Subject: [PATCH] Switch to new include path and namespace --- cc/runfiles/BUILD | 4 +--- cc/runfiles/runfiles.cc | 12 +++++------- cc/runfiles/runfiles.h | 20 +++++++++----------- tests/runfiles/runfiles_test.cc | 16 +++++++--------- 4 files changed, 22 insertions(+), 30 deletions(-) diff --git a/cc/runfiles/BUILD b/cc/runfiles/BUILD index f960a4e..6400db7 100644 --- a/cc/runfiles/BUILD +++ b/cc/runfiles/BUILD @@ -6,9 +6,7 @@ cc_library( name = "runfiles", srcs = ["runfiles.cc"], hdrs = ["runfiles.h"], - # Ensure that this header can be included from the same directory as the - # legacy @bazel_tools//tools/cpp/runfiles library. - include_prefix = "tools/cpp/runfiles", + include_prefix = "rules_cc/cc/runfiles", strip_include_prefix = ".", visibility = ["//visibility:public"], ) diff --git a/cc/runfiles/runfiles.cc b/cc/runfiles/runfiles.cc index 2dcc015..3a9257e 100644 --- a/cc/runfiles/runfiles.cc +++ b/cc/runfiles/runfiles.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tools/cpp/runfiles/runfiles.h" +#include "rules_cc/cc/runfiles/runfiles.h" #ifdef _WIN32 #include @@ -34,9 +34,8 @@ #include #endif // _WIN32 -namespace bazel { -namespace tools { -namespace cpp { +namespace rules_cc { +namespace cc { namespace runfiles { using std::function; @@ -479,6 +478,5 @@ bool PathsFrom(const string& argv0, string mf, string dir, } // namespace } // namespace runfiles -} // namespace cpp -} // namespace tools -} // namespace bazel +} // namespace cc +} // namespace rules_cc diff --git a/cc/runfiles/runfiles.h b/cc/runfiles/runfiles.h index d428965..d80a602 100644 --- a/cc/runfiles/runfiles.h +++ b/cc/runfiles/runfiles.h @@ -25,9 +25,9 @@ // // 2. Include the runfiles library. // -// #include "tools/cpp/runfiles/runfiles.h" +// #include "rules_cc/cc/runfiles/runfiles.h" // -// using bazel::tools::cpp::runfiles::Runfiles; +// using rules_cc::cc::runfiles::Runfiles; // // 3. Create a Runfiles object and use rlocation to look up runfile paths: // @@ -77,8 +77,8 @@ // execv(args[0], args); // } -#ifndef TOOLS_CPP_RUNFILES_RUNFILES_H_ -#define TOOLS_CPP_RUNFILES_RUNFILES_H_ 1 +#ifndef RULES_CC_CC_RUNFILES_RUNFILES_H_ +#define RULES_CC_CC_RUNFILES_RUNFILES_H_ 1 #include #include @@ -86,9 +86,8 @@ #include #include -namespace bazel { -namespace tools { -namespace cpp { +namespace rules_cc { +namespace cc { namespace runfiles { class Runfiles { @@ -259,8 +258,7 @@ bool TestOnly_IsAbsolute(const std::string& path); } // namespace testing } // namespace runfiles -} // namespace cpp -} // namespace tools -} // namespace bazel +} // namespace cc +} // namespace rules_cc -#endif // TOOLS_CPP_RUNFILES_RUNFILES_H_ +#endif // RULES_CC_CC_RUNFILES_RUNFILES_H_ diff --git a/tests/runfiles/runfiles_test.cc b/tests/runfiles/runfiles_test.cc index 37391d6..0f7e894 100644 --- a/tests/runfiles/runfiles_test.cc +++ b/tests/runfiles/runfiles_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tools/cpp/runfiles/runfiles.h" +#include "rules_cc/cc/runfiles/runfiles.h" #ifdef _WIN32 #include @@ -29,14 +29,13 @@ #define RUNFILES_TEST_TOSTRING(x) RUNFILES_TEST_TOSTRING_HELPER(x) #define LINE_AS_STRING() RUNFILES_TEST_TOSTRING(__LINE__) -namespace bazel { -namespace tools { -namespace cpp { +namespace rules_cc { +namespace cc { namespace runfiles { namespace { -using bazel::tools::cpp::runfiles::testing::TestOnly_IsAbsolute; -using bazel::tools::cpp::runfiles::testing::TestOnly_PathsFrom; +using rules_cc::cc::runfiles::testing::TestOnly_IsAbsolute; +using rules_cc::cc::runfiles::testing::TestOnly_PathsFrom; using std::cerr; using std::endl; using std::function; @@ -877,6 +876,5 @@ TEST_F(RunfilesTest, InvalidRepoMapping) { } // namespace } // namespace runfiles -} // namespace cpp -} // namespace tools -} // namespace bazel +} // namespace cc +} // namespace rules_cc