mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
bazel: Drop dependency on util/flags.h
in runfiles helper
Bazel's `Runfiles::Create()` does not actually need a value for `argv0` in order to find runfiles for the current `cc_binary`. - Rename `runfiles.cc` to `runfiles_nobazel.cc` PiperOrigin-RevId: 443061178 Change-Id: I31e16d69d24aecbc403f9407fc08c615bb1e8f9f
This commit is contained in:
parent
456d9f341e
commit
5159addd1b
|
@ -22,7 +22,7 @@ namespace sapi {
|
||||||
std::string GetTestTempPath(absl::string_view name) {
|
std::string GetTestTempPath(absl::string_view name) {
|
||||||
// When using Bazel, the environment variable TEST_TMPDIR is guaranteed to be
|
// When using Bazel, the environment variable TEST_TMPDIR is guaranteed to be
|
||||||
// set.
|
// set.
|
||||||
// See https://docs.bazel.build/versions/master/test-encyclopedia.html for
|
// See https://bazel.build/reference/test-encyclopedia#initial-conditions for
|
||||||
// details.
|
// details.
|
||||||
const char* test_tmpdir = getenv("TEST_TMPDIR");
|
const char* test_tmpdir = getenv("TEST_TMPDIR");
|
||||||
return file::JoinPath(test_tmpdir ? test_tmpdir : ".", name);
|
return file::JoinPath(test_tmpdir ? test_tmpdir : ".", name);
|
||||||
|
|
|
@ -125,7 +125,7 @@ cc_library(
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "runfiles",
|
name = "runfiles",
|
||||||
srcs = ["runfiles.cc"],
|
srcs = ["runfiles_bazel.cc"],
|
||||||
hdrs = ["runfiles.h"],
|
hdrs = ["runfiles.h"],
|
||||||
copts = sapi_platform_copts(),
|
copts = sapi_platform_copts(),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
|
||||||
#include "sandboxed_api/util/path.h"
|
#include "sandboxed_api/util/path.h"
|
||||||
#include "sandboxed_api/util/raw_logging.h"
|
#include "sandboxed_api/util/raw_logging.h"
|
||||||
#include "sandboxed_api/util/runfiles.h"
|
#include "sandboxed_api/util/runfiles.h"
|
||||||
|
@ -28,7 +27,7 @@ std::string GetDataDependencyFilePath(absl::string_view relative_path) {
|
||||||
|
|
||||||
static Runfiles* runfiles = []() {
|
static Runfiles* runfiles = []() {
|
||||||
std::string error;
|
std::string error;
|
||||||
auto* runfiles = Runfiles::Create(gflags::GetArgv0(), &error);
|
auto* runfiles = Runfiles::Create(/*argv=*/"" /* unknown */, &error);
|
||||||
SAPI_RAW_CHECK(runfiles != nullptr, error.c_str());
|
SAPI_RAW_CHECK(runfiles != nullptr, error.c_str());
|
||||||
|
|
||||||
// Setup environment for child processes.
|
// Setup environment for child processes.
|
Loading…
Reference in New Issue
Block a user