2
0
Fork 0
mirror of https://github.com/bazelbuild/rules_cc synced 2024-12-03 02:53:18 +00:00

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", name = "runfiles",
srcs = ["runfiles.cc"], srcs = ["runfiles.cc"],
hdrs = ["runfiles.h"], hdrs = ["runfiles.h"],
# Ensure that this header can be included from the same directory as the include_prefix = "rules_cc/cc/runfiles",
# legacy @bazel_tools//tools/cpp/runfiles library.
include_prefix = "tools/cpp/runfiles",
strip_include_prefix = ".", strip_include_prefix = ".",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "tools/cpp/runfiles/runfiles.h" #include "rules_cc/cc/runfiles/runfiles.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -34,9 +34,8 @@
#include <memory> #include <memory>
#endif // _WIN32 #endif // _WIN32
namespace bazel { namespace rules_cc {
namespace tools { namespace cc {
namespace cpp {
namespace runfiles { namespace runfiles {
using std::function; using std::function;
@ -479,6 +478,5 @@ bool PathsFrom(const string& argv0, string mf, string dir,
} // namespace } // namespace
} // namespace runfiles } // namespace runfiles
} // namespace cpp } // namespace cc
} // namespace tools } // namespace rules_cc
} // namespace bazel

View file

@ -25,9 +25,9 @@
// //
// 2. Include the runfiles library. // 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: // 3. Create a Runfiles object and use rlocation to look up runfile paths:
// //
@ -77,8 +77,8 @@
// execv(args[0], args); // execv(args[0], args);
// } // }
#ifndef TOOLS_CPP_RUNFILES_RUNFILES_H_ #ifndef RULES_CC_CC_RUNFILES_RUNFILES_H_
#define TOOLS_CPP_RUNFILES_RUNFILES_H_ 1 #define RULES_CC_CC_RUNFILES_RUNFILES_H_ 1
#include <functional> #include <functional>
#include <map> #include <map>
@ -86,9 +86,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace bazel { namespace rules_cc {
namespace tools { namespace cc {
namespace cpp {
namespace runfiles { namespace runfiles {
class Runfiles { class Runfiles {
@ -259,8 +258,7 @@ bool TestOnly_IsAbsolute(const std::string& path);
} // namespace testing } // namespace testing
} // namespace runfiles } // namespace runfiles
} // namespace cpp } // namespace cc
} // namespace tools } // namespace rules_cc
} // namespace bazel
#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 // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "tools/cpp/runfiles/runfiles.h" #include "rules_cc/cc/runfiles/runfiles.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -29,14 +29,13 @@
#define RUNFILES_TEST_TOSTRING(x) RUNFILES_TEST_TOSTRING_HELPER(x) #define RUNFILES_TEST_TOSTRING(x) RUNFILES_TEST_TOSTRING_HELPER(x)
#define LINE_AS_STRING() RUNFILES_TEST_TOSTRING(__LINE__) #define LINE_AS_STRING() RUNFILES_TEST_TOSTRING(__LINE__)
namespace bazel { namespace rules_cc {
namespace tools { namespace cc {
namespace cpp {
namespace runfiles { namespace runfiles {
namespace { namespace {
using bazel::tools::cpp::runfiles::testing::TestOnly_IsAbsolute; using rules_cc::cc::runfiles::testing::TestOnly_IsAbsolute;
using bazel::tools::cpp::runfiles::testing::TestOnly_PathsFrom; using rules_cc::cc::runfiles::testing::TestOnly_PathsFrom;
using std::cerr; using std::cerr;
using std::endl; using std::endl;
using std::function; using std::function;
@ -877,6 +876,5 @@ TEST_F(RunfilesTest, InvalidRepoMapping) {
} // namespace } // namespace
} // namespace runfiles } // namespace runfiles
} // namespace cpp } // namespace cc
} // namespace tools } // namespace rules_cc
} // namespace bazel