提交 8777ff3f 编写于 作者: Y Yi Wang

Use yapf to auto format all BUILD and WORKSPACE files

上级 6a989170
...@@ -3,7 +3,7 @@ http_archive( ...@@ -3,7 +3,7 @@ http_archive(
name="protobuf", name="protobuf",
url="http://github.com/google/protobuf/archive/v3.1.0.tar.gz", url="http://github.com/google/protobuf/archive/v3.1.0.tar.gz",
sha256="0a0ae63cbffc274efb573bdde9a253e3f32e458c41261df51c5dbc5ad541e8f7", sha256="0a0ae63cbffc274efb573bdde9a253e3f32e458c41261df51c5dbc5ad541e8f7",
strip_prefix="protobuf-3.1.0", ) strip_prefix="protobuf-3.1.0")
# External dependency to gtest 1.7.0. This method comes from # External dependency to gtest 1.7.0. This method comes from
# https://www.bazel.io/versions/master/docs/tutorial/cpp.html. # https://www.bazel.io/versions/master/docs/tutorial/cpp.html.
...@@ -12,7 +12,7 @@ new_http_archive( ...@@ -12,7 +12,7 @@ new_http_archive(
url="https://github.com/google/googletest/archive/release-1.7.0.zip", url="https://github.com/google/googletest/archive/release-1.7.0.zip",
sha256="b58cb7547a28b2c718d1e38aee18a3659c9e3ff52440297e965f5edffe34b6d0", sha256="b58cb7547a28b2c718d1e38aee18a3659c9e3ff52440297e965f5edffe34b6d0",
build_file="third_party/gtest.BUILD", build_file="third_party/gtest.BUILD",
strip_prefix="googletest-release-1.7.0", ) strip_prefix="googletest-release-1.7.0")
# External dependency to gflags. This method comes from # External dependency to gflags. This method comes from
# https://github.com/gflags/example/blob/master/WORKSPACE. # https://github.com/gflags/example/blob/master/WORKSPACE.
...@@ -20,8 +20,7 @@ new_git_repository( ...@@ -20,8 +20,7 @@ new_git_repository(
name="gflags", name="gflags",
tag="v2.2.0", tag="v2.2.0",
remote="https://github.com/gflags/gflags.git", remote="https://github.com/gflags/gflags.git",
build_file="third_party/gflags.BUILD", build_file="third_party/gflags.BUILD")
)
# External dependency to glog. This method comes from # External dependency to glog. This method comes from
# https://github.com/reyoung/bazel_playground/blob/master/WORKSPACE # https://github.com/reyoung/bazel_playground/blob/master/WORKSPACE
......
...@@ -12,13 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,13 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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 "hl_cuda.h"
#include <cuda_profiler_api.h> #include <cuda_profiler_api.h>
#include <string.h> #include <string.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <mutex> #include <mutex>
#include "hl_cuda.h"
#include "hl_cuda.ph" #include "hl_cuda.ph"
#include "hl_dso_loader.h" #include "hl_dso_loader.h"
#include "hl_thread.ph" #include "hl_thread.ph"
......
licenses(["notice"]) # Apache 2.0 licenses(["notice"]) # Apache 2.0
cc_test( cc_test(
name = "gflags_test", name="gflags_test",
srcs = ["gflags_test.cc"], srcs=["gflags_test.cc"],
copts = ["-Iexternal/gtest/include"], copts=["-Iexternal/gtest/include"],
deps = [ deps=[
"@gtest//:gtest", "@gtest//:gtest",
"@gflags//:gflags", "@gflags//:gflags",
], ], )
)
...@@ -4,17 +4,14 @@ ...@@ -4,17 +4,14 @@
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
DEFINE_bool(verbose, false, "Display program name before message"); DEFINE_bool(verbose, false, "Display program name before message");
DEFINE_string(message, "Hello world!", "Message to print"); DEFINE_string(message, "Hello world!", "Message to print");
static bool IsNonEmptyMessage(const char *flagname, const std::string &value) static bool IsNonEmptyMessage(const char *flagname, const std::string &value) {
{
return value[0] != '\0'; return value[0] != '\0';
} }
DEFINE_validator(message, &IsNonEmptyMessage); DEFINE_validator(message, &IsNonEmptyMessage);
namespace third_party { namespace third_party {
namespace gflags_test { namespace gflags_test {
...@@ -23,10 +20,10 @@ TEST(GflagsTest, ParseAndPrint) { ...@@ -23,10 +20,10 @@ TEST(GflagsTest, ParseAndPrint) {
gflags::SetVersionString("1.0.0"); gflags::SetVersionString("1.0.0");
int argc = 1; int argc = 1;
char program_name[] = "gflags_test"; char program_name[] = "gflags_test";
char** argv = new char*[2]; char **argv = new char *[2];
argv[0] = program_name; argv[0] = program_name;
argv[1] = NULL; argv[1] = NULL;
gflags::ParseCommandLineFlags(&argc, reinterpret_cast<char***>(&argv), true); gflags::ParseCommandLineFlags(&argc, reinterpret_cast<char ***>(&argv), true);
EXPECT_EQ("gflags_test", std::string(gflags::ProgramInvocationShortName())); EXPECT_EQ("gflags_test", std::string(gflags::ProgramInvocationShortName()));
EXPECT_EQ("Hello world!", FLAGS_message); EXPECT_EQ("Hello world!", FLAGS_message);
gflags::ShutDownCommandLineFlags(); gflags::ShutDownCommandLineFlags();
......
licenses(["notice"]) licenses(["notice"])
cc_library( cc_library(
visibility = ["//visibility:public"], visibility=["//visibility:public"],
name = "glog", name="glog",
includes = [ includes=[
".", ".",
"src", "src",
], ],
copts = [ copts=[
"-D_START_GOOGLE_NAMESPACE_='namespace google {'", "-D_START_GOOGLE_NAMESPACE_='namespace google {'",
"-D_END_GOOGLE_NAMESPACE_='}'", "-D_END_GOOGLE_NAMESPACE_='}'",
"-DGOOGLE_NAMESPACE='google'", "-DGOOGLE_NAMESPACE='google'",
...@@ -45,7 +45,7 @@ cc_library( ...@@ -45,7 +45,7 @@ cc_library(
#"-fno-sanitize=address", #"-fno-sanitize=address",
"-Iexternal/glog/src", "-Iexternal/glog/src",
], ],
srcs = [ srcs=[
"src/demangle.cc", "src/demangle.cc",
"src/logging.cc", "src/logging.cc",
"src/raw_logging.cc", "src/raw_logging.cc",
...@@ -59,7 +59,7 @@ cc_library( ...@@ -59,7 +59,7 @@ cc_library(
":stl_logging_h", ":stl_logging_h",
":vlog_is_on_h", ":vlog_is_on_h",
], ],
hdrs = [ hdrs=[
"src/demangle.h", "src/demangle.h",
"src/mock-log.h", "src/mock-log.h",
"src/stacktrace.h", "src/stacktrace.h",
...@@ -69,74 +69,47 @@ cc_library( ...@@ -69,74 +69,47 @@ cc_library(
"src/base/googleinit.h", "src/base/googleinit.h",
"src/base/mutex.h", "src/base/mutex.h",
"src/glog/log_severity.h", "src/glog/log_severity.h",
], ])
)
genrule( genrule(
name = "config_h", name="config_h",
srcs = [ srcs=["src/config.h.cmake.in"],
"src/config.h.cmake.in", outs=["config.h"],
], cmd="awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)",
outs = [
"config.h",
],
cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)",
) )
genrule( genrule(
name = "logging_h", name="logging_h",
srcs = [ srcs=["src/glog/logging.h.in"],
"src/glog/logging.h.in", outs=["glog/logging.h"],
], cmd="$(location :gen_sh) < $(<) > $(@)",
outs = [ tools=[":gen_sh"])
"glog/logging.h",
],
cmd = "$(location :gen_sh) < $(<) > $(@)",
tools = [":gen_sh"],
)
genrule( genrule(
name = "raw_logging_h", name="raw_logging_h",
srcs = [ srcs=["src/glog/raw_logging.h.in"],
"src/glog/raw_logging.h.in", outs=["glog/raw_logging.h"],
], cmd="$(location :gen_sh) < $(<) > $(@)",
outs = [ tools=[":gen_sh"])
"glog/raw_logging.h",
],
cmd = "$(location :gen_sh) < $(<) > $(@)",
tools = [":gen_sh"],
)
genrule( genrule(
name = "stl_logging_h", name="stl_logging_h",
srcs = [ srcs=["src/glog/stl_logging.h.in"],
"src/glog/stl_logging.h.in", outs=["glog/stl_logging.h"],
], cmd="$(location :gen_sh) < $(<) > $(@)",
outs = [ tools=[":gen_sh"])
"glog/stl_logging.h",
],
cmd = "$(location :gen_sh) < $(<) > $(@)",
tools = [":gen_sh"],
)
genrule( genrule(
name = "vlog_is_on_h", name="vlog_is_on_h",
srcs = [ srcs=["src/glog/vlog_is_on.h.in"],
"src/glog/vlog_is_on.h.in", outs=["glog/vlog_is_on.h"],
], cmd="$(location :gen_sh) < $(<) > $(@)",
outs = [ tools=[":gen_sh"])
"glog/vlog_is_on.h",
],
cmd = "$(location :gen_sh) < $(<) > $(@)",
tools = [":gen_sh"],
)
genrule( genrule(
name = "gen_sh", name="gen_sh",
outs = [ outs=["gen.sh"],
"gen.sh", cmd="""
],
cmd = """
cat > $@ <<"EOF" cat > $@ <<"EOF"
#! /bin/sh #! /bin/sh
sed -e 's/@ac_cv_have_unistd_h@/1/g' \ sed -e 's/@ac_cv_have_unistd_h@/1/g' \
...@@ -152,5 +125,4 @@ sed -e 's/@ac_cv_have_unistd_h@/1/g' \ ...@@ -152,5 +125,4 @@ sed -e 's/@ac_cv_have_unistd_h@/1/g' \
-e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \ -e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \
-e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \ -e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \
-e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g' -e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g'
EOF""" EOF""")
)
licenses(["notice"]) # Apache 2.0 licenses(["notice"]) # Apache 2.0
cc_test( cc_test(
name = "glog_test", name="glog_test",
srcs = ["glog_test.cc"], srcs=["glog_test.cc"],
copts = ["-Iexternal/gtest/include"], copts=["-Iexternal/gtest/include"],
deps =[ deps=[
"@gtest//:gtest", "@gtest//:gtest",
"@glog//:glog", "@glog//:glog",
], ], )
)
...@@ -4,6 +4,4 @@ ...@@ -4,6 +4,4 @@
#include "glog/logging.h" #include "glog/logging.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
TEST(GlogTest, Logging) { TEST(GlogTest, Logging) { LOG(INFO) << "Hello world"; }
LOG(INFO) << "Hello world";
}
cc_library( cc_library(
name = "gtest", name="gtest",
srcs = glob( srcs=glob(
["src/*.cc"], ["src/*.cc"], exclude=["src/gtest-all.cc"]),
exclude = ["src/gtest-all.cc"] hdrs=glob(["include/**/*.h", "src/*.h"]),
), copts=["-Iexternal/gtest/include"],
hdrs = glob([ linkopts=["-pthread"],
"include/**/*.h", visibility=["//visibility:public"], )
"src/*.h"
]),
copts = ["-Iexternal/gtest/include"],
linkopts = ["-pthread"],
visibility = ["//visibility:public"],
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册