Switch to new include path and namespace

This commit is contained in:
Fabian Meumertzheim 2024-11-05 14:51:09 +01:00
parent 82e44f3c47
commit 885d333d55
4 changed files with 22 additions and 30 deletions

View File

@ -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"],
)

View File

@ -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 <windows.h>
@ -34,9 +34,8 @@
#include <memory>
#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

View File

@ -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 <functional>
#include <map>
@ -86,9 +86,8 @@
#include <string>
#include <vector>
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_

View File

@ -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 <windows.h>
@ -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