Skip to content

Commit 8777ff3

Browse files
author
Yi Wang
committed
Use yapf to auto format all BUILD and WORKSPACE files
1 parent 6a98917 commit 8777ff3

File tree

8 files changed

+60
-102
lines changed

8 files changed

+60
-102
lines changed

WORKSPACE

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ http_archive(
33
name="protobuf",
44
url="http://github.com/google/protobuf/archive/v3.1.0.tar.gz",
55
sha256="0a0ae63cbffc274efb573bdde9a253e3f32e458c41261df51c5dbc5ad541e8f7",
6-
strip_prefix="protobuf-3.1.0", )
6+
strip_prefix="protobuf-3.1.0")
77

88
# External dependency to gtest 1.7.0. This method comes from
99
# https://www.bazel.io/versions/master/docs/tutorial/cpp.html.
@@ -12,16 +12,15 @@ new_http_archive(
1212
url="https://github.com/google/googletest/archive/release-1.7.0.zip",
1313
sha256="b58cb7547a28b2c718d1e38aee18a3659c9e3ff52440297e965f5edffe34b6d0",
1414
build_file="third_party/gtest.BUILD",
15-
strip_prefix="googletest-release-1.7.0", )
15+
strip_prefix="googletest-release-1.7.0")
1616

1717
# External dependency to gflags. This method comes from
1818
# https://github.com/gflags/example/blob/master/WORKSPACE.
1919
new_git_repository(
2020
name="gflags",
2121
tag="v2.2.0",
2222
remote="https://github.com/gflags/gflags.git",
23-
build_file="third_party/gflags.BUILD",
24-
)
23+
build_file="third_party/gflags.BUILD")
2524

2625
# External dependency to glog. This method comes from
2726
# https://github.com/reyoung/bazel_playground/blob/master/WORKSPACE

paddle/cuda/src/hl_cuda_device.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

15-
#include "hl_cuda.h"
1615
#include <cuda_profiler_api.h>
1716
#include <string.h>
1817
#include <sys/syscall.h>
1918
#include <sys/time.h>
2019
#include <unistd.h>
2120
#include <mutex>
21+
#include "hl_cuda.h"
2222
#include "hl_cuda.ph"
2323
#include "hl_dso_loader.h"
2424
#include "hl_thread.ph"

third_party/gflags_test/BUILD

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
licenses(["notice"]) # Apache 2.0
22

33
cc_test(
4-
name = "gflags_test",
5-
srcs = ["gflags_test.cc"],
6-
copts = ["-Iexternal/gtest/include"],
7-
deps = [
4+
name="gflags_test",
5+
srcs=["gflags_test.cc"],
6+
copts=["-Iexternal/gtest/include"],
7+
deps=[
88
"@gtest//:gtest",
99
"@gflags//:gflags",
10-
],
11-
)
10+
], )

third_party/gflags_test/gflags_test.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
#include "gflags/gflags.h"
55
#include "gtest/gtest.h"
66

7-
87
DEFINE_bool(verbose, false, "Display program name before message");
98
DEFINE_string(message, "Hello world!", "Message to print");
109

11-
static bool IsNonEmptyMessage(const char *flagname, const std::string &value)
12-
{
10+
static bool IsNonEmptyMessage(const char *flagname, const std::string &value) {
1311
return value[0] != '\0';
1412
}
1513
DEFINE_validator(message, &IsNonEmptyMessage);
1614

17-
1815
namespace third_party {
1916
namespace gflags_test {
2017

@@ -23,10 +20,10 @@ TEST(GflagsTest, ParseAndPrint) {
2320
gflags::SetVersionString("1.0.0");
2421
int argc = 1;
2522
char program_name[] = "gflags_test";
26-
char** argv = new char*[2];
23+
char **argv = new char *[2];
2724
argv[0] = program_name;
2825
argv[1] = NULL;
29-
gflags::ParseCommandLineFlags(&argc, reinterpret_cast<char***>(&argv), true);
26+
gflags::ParseCommandLineFlags(&argc, reinterpret_cast<char ***>(&argv), true);
3027
EXPECT_EQ("gflags_test", std::string(gflags::ProgramInvocationShortName()));
3128
EXPECT_EQ("Hello world!", FLAGS_message);
3229
gflags::ShutDownCommandLineFlags();

third_party/glog.BUILD

Lines changed: 35 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
licenses(["notice"])
22

33
cc_library(
4-
visibility = ["//visibility:public"],
5-
name = "glog",
6-
includes = [
4+
visibility=["//visibility:public"],
5+
name="glog",
6+
includes=[
77
".",
88
"src",
99
],
10-
copts = [
10+
copts=[
1111
"-D_START_GOOGLE_NAMESPACE_='namespace google {'",
1212
"-D_END_GOOGLE_NAMESPACE_='}'",
1313
"-DGOOGLE_NAMESPACE='google'",
@@ -45,7 +45,7 @@ cc_library(
4545
#"-fno-sanitize=address",
4646
"-Iexternal/glog/src",
4747
],
48-
srcs = [
48+
srcs=[
4949
"src/demangle.cc",
5050
"src/logging.cc",
5151
"src/raw_logging.cc",
@@ -59,7 +59,7 @@ cc_library(
5959
":stl_logging_h",
6060
":vlog_is_on_h",
6161
],
62-
hdrs = [
62+
hdrs=[
6363
"src/demangle.h",
6464
"src/mock-log.h",
6565
"src/stacktrace.h",
@@ -69,74 +69,47 @@ cc_library(
6969
"src/base/googleinit.h",
7070
"src/base/mutex.h",
7171
"src/glog/log_severity.h",
72-
],
73-
)
72+
])
7473

7574
genrule(
76-
name = "config_h",
77-
srcs = [
78-
"src/config.h.cmake.in",
79-
],
80-
outs = [
81-
"config.h",
82-
],
83-
cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)",
75+
name="config_h",
76+
srcs=["src/config.h.cmake.in"],
77+
outs=["config.h"],
78+
cmd="awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)",
8479
)
8580

8681
genrule(
87-
name = "logging_h",
88-
srcs = [
89-
"src/glog/logging.h.in",
90-
],
91-
outs = [
92-
"glog/logging.h",
93-
],
94-
cmd = "$(location :gen_sh) < $(<) > $(@)",
95-
tools = [":gen_sh"],
96-
)
82+
name="logging_h",
83+
srcs=["src/glog/logging.h.in"],
84+
outs=["glog/logging.h"],
85+
cmd="$(location :gen_sh) < $(<) > $(@)",
86+
tools=[":gen_sh"])
9787

9888
genrule(
99-
name = "raw_logging_h",
100-
srcs = [
101-
"src/glog/raw_logging.h.in",
102-
],
103-
outs = [
104-
"glog/raw_logging.h",
105-
],
106-
cmd = "$(location :gen_sh) < $(<) > $(@)",
107-
tools = [":gen_sh"],
108-
)
89+
name="raw_logging_h",
90+
srcs=["src/glog/raw_logging.h.in"],
91+
outs=["glog/raw_logging.h"],
92+
cmd="$(location :gen_sh) < $(<) > $(@)",
93+
tools=[":gen_sh"])
10994

11095
genrule(
111-
name = "stl_logging_h",
112-
srcs = [
113-
"src/glog/stl_logging.h.in",
114-
],
115-
outs = [
116-
"glog/stl_logging.h",
117-
],
118-
cmd = "$(location :gen_sh) < $(<) > $(@)",
119-
tools = [":gen_sh"],
120-
)
96+
name="stl_logging_h",
97+
srcs=["src/glog/stl_logging.h.in"],
98+
outs=["glog/stl_logging.h"],
99+
cmd="$(location :gen_sh) < $(<) > $(@)",
100+
tools=[":gen_sh"])
121101

122102
genrule(
123-
name = "vlog_is_on_h",
124-
srcs = [
125-
"src/glog/vlog_is_on.h.in",
126-
],
127-
outs = [
128-
"glog/vlog_is_on.h",
129-
],
130-
cmd = "$(location :gen_sh) < $(<) > $(@)",
131-
tools = [":gen_sh"],
132-
)
103+
name="vlog_is_on_h",
104+
srcs=["src/glog/vlog_is_on.h.in"],
105+
outs=["glog/vlog_is_on.h"],
106+
cmd="$(location :gen_sh) < $(<) > $(@)",
107+
tools=[":gen_sh"])
133108

134109
genrule(
135-
name = "gen_sh",
136-
outs = [
137-
"gen.sh",
138-
],
139-
cmd = """
110+
name="gen_sh",
111+
outs=["gen.sh"],
112+
cmd="""
140113
cat > $@ <<"EOF"
141114
#! /bin/sh
142115
sed -e 's/@ac_cv_have_unistd_h@/1/g' \
@@ -152,5 +125,4 @@ sed -e 's/@ac_cv_have_unistd_h@/1/g' \
152125
-e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \
153126
-e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \
154127
-e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g'
155-
EOF"""
156-
)
128+
EOF""")

third_party/glog_test/BUILD

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
licenses(["notice"]) # Apache 2.0
22

33
cc_test(
4-
name = "glog_test",
5-
srcs = ["glog_test.cc"],
6-
copts = ["-Iexternal/gtest/include"],
7-
deps =[
4+
name="glog_test",
5+
srcs=["glog_test.cc"],
6+
copts=["-Iexternal/gtest/include"],
7+
deps=[
88
"@gtest//:gtest",
99
"@glog//:glog",
10-
],
11-
)
10+
], )

third_party/glog_test/glog_test.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44
#include "glog/logging.h"
55
#include "gtest/gtest.h"
66

7-
TEST(GlogTest, Logging) {
8-
LOG(INFO) << "Hello world";
9-
}
7+
TEST(GlogTest, Logging) { LOG(INFO) << "Hello world"; }

third_party/gtest.BUILD

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
cc_library(
2-
name = "gtest",
3-
srcs = glob(
4-
["src/*.cc"],
5-
exclude = ["src/gtest-all.cc"]
6-
),
7-
hdrs = glob([
8-
"include/**/*.h",
9-
"src/*.h"
10-
]),
11-
copts = ["-Iexternal/gtest/include"],
12-
linkopts = ["-pthread"],
13-
visibility = ["//visibility:public"],
14-
)
2+
name="gtest",
3+
srcs=glob(
4+
["src/*.cc"], exclude=["src/gtest-all.cc"]),
5+
hdrs=glob(["include/**/*.h", "src/*.h"]),
6+
copts=["-Iexternal/gtest/include"],
7+
linkopts=["-pthread"],
8+
visibility=["//visibility:public"], )

0 commit comments

Comments
 (0)