From 921651e97c3892e656287f1cfa923319f0799729 Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Sun, 9 Jul 2017 00:38:46 -0400 Subject: [PATCH 1/5] Build with Bazel. --- .gitignore | 3 +- BUILD | 4 ++ WORKSPACE | 10 +++ bazel/glog.bzl | 165 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 BUILD create mode 100644 WORKSPACE create mode 100644 bazel/glog.bzl diff --git a/.gitignore b/.gitignore index 0b99cca..76d251f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ CMakeFiles/ config.h *.sln *.vcxproj -*.filters \ No newline at end of file +*.filters +bazel-* diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..7bbd32d --- /dev/null +++ b/BUILD @@ -0,0 +1,4 @@ +licenses(['notice']) + +load(':bazel/glog.bzl', 'glog_library') +glog_library() diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..f5d080e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,10 @@ +git_repository( + name = "com_github_gflags_gflags", + remote = "https://github.com/gflags/gflags.git", + tag = 'v2.2.1', +) + +bind( + name = "gflags", + actual = "@com_github_gflags_gflags//:gflags", +) diff --git a/bazel/glog.bzl b/bazel/glog.bzl new file mode 100644 index 0000000..ff2a268 --- /dev/null +++ b/bazel/glog.bzl @@ -0,0 +1,165 @@ +# Implement a macro glog_library() that the BUILD file can load. +# By default, glog is built with gflags support. You can change this behavior by using +# glog_library(with_gflags=0) +# +# This file is inspired by the following sample BUILD files: +# https://github.com/google/glog/issues/61 +# https://github.com/google/glog/files/393474/BUILD.txt + +def glog_library(with_gflags=1): + native.cc_library( + name = 'glog', + visibility = [ '//visibility:public' ], + srcs = [ + 'src/base/commandlineflags.h', + 'src/base/googleinit.h', + 'src/demangle.cc', + 'src/logging.cc', + 'src/raw_logging.cc', + 'src/signalhandler.cc', + 'src/symbolize.cc', + 'src/utilities.cc', + 'src/vlog_is_on.cc', + ], + hdrs = [ + 'src/base/mutex.h', + 'src/demangle.h', + 'src/stacktrace.h', + 'src/symbolize.h', + 'src/utilities.h', + 'src/glog/log_severity.h', + ], + includes = [ + 'src', + ], + copts = [ + # Disable warnings that exists in glog + '-Wno-sign-compare', + '-Wno-unused-local-typedefs', + ## Inject google namespace as 'google' + "-D_START_GOOGLE_NAMESPACE_='namespace google {'", + "-D_END_GOOGLE_NAMESPACE_='}'", + "-DGOOGLE_NAMESPACE='google'", + # Allows src/base/mutex.h to include pthread.h. + '-DHAVE_PTHREAD', + # Allows src/logging.cc to determine the host name. + '-DHAVE_SYS_UTSNAME_H', + # System header files enabler for src/utilities.cc + # Enable system calls from syscall.h + '-DHAVE_SYS_SYSCALL_H', + # Enable system calls from sys/time.h + '-DHAVE_SYS_TIME_H', + '-DHAVE_STDINT_H', + '-DHAVE_STRING_H', + # For logging.cc + '-DHAVE_PREAD', + ] + [ + '-DHAVE_LIB_GFLAGS' + ] if with_gflags else [], + deps = [ ':internal_headers' ] + \ + [ '//external:gflags' ] if with_gflags else [], + ) + + internal_headers = [ + ':config_h', + ':logging_h', + ':raw_logging_h', + ':stl_logging_h', + ':vlog_is_on_h', + ] + + if PACKAGE_NAME: + native.cc_library( + name = 'internal_headers', + hdrs = internal_headers, + includes = [ + PACKAGE_NAME, + ], + ) + else: + native.cc_library( + name = 'internal_headers', + hdrs = internal_headers, + ) + + native.genrule( + name = 'gen_sh', + outs = [ + 'gen.sh', + ], + cmd = ''' +#! /bin/sh +cat > $@ <<"EOF" +sed -e 's/@ac_cv_have_unistd_h@/1/g' \ + -e 's/@ac_cv_have_stdint_h@/1/g' \ + -e 's/@ac_cv_have_systypes_h@/1/g' \ + -e 's/@ac_cv_have_libgflags_h@/1/g' \ + -e 's/@ac_cv_have_uint16_t@/1/g' \ + -e 's/@ac_cv_have___builtin_expect@/1/g' \ + -e 's/@ac_cv_have_.*@/0/g' \ + -e 's/@ac_google_start_namespace@/namespace google {/g' \ + -e 's/@ac_google_end_namespace@/}/g' \ + -e 's/@ac_google_namespace@/google/g' \ + -e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \ + -e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \ + -e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g' +EOF''') + + native.genrule( + name = 'config_h', + srcs = [ + 'src/config.h.cmake.in', + ], + outs = [ + '/'.join([PACKAGE_NAME, 'config.h']) if PACKAGE_NAME else 'config.h', + ], + cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)", + ) + + native.genrule( + name = 'logging_h', + srcs = [ + 'src/glog/logging.h.in', + ], + outs = [ + '/'.join([PACKAGE_NAME, 'glog/logging.h']) if PACKAGE_NAME else 'glog/logging.h', + ], + cmd = '$(location :gen_sh) < $(<) > $(@)', + tools = [':gen_sh'], + ) + + native.genrule( + name = 'raw_logging_h', + srcs = [ + 'src/glog/raw_logging.h.in', + ], + outs = [ + '/'.join([PACKAGE_NAME, 'glog/raw_logging.h']) if PACKAGE_NAME else 'glog/raw_logging.h', + ], + cmd = '$(location :gen_sh) < $(<) > $(@)', + tools = [':gen_sh'], + ) + + native.genrule( + name = 'stl_logging_h', + srcs = [ + 'src/glog/stl_logging.h.in', + ], + outs = [ + '/'.join([PACKAGE_NAME, 'glog/stl_logging.h']) if PACKAGE_NAME else 'glog/stl_logging.h', + ], + cmd = '$(location :gen_sh) < $(<) > $(@)', + tools = [':gen_sh'], + ) + + native.genrule( + name = 'vlog_is_on_h', + srcs = [ + 'src/glog/vlog_is_on.h.in', + ], + outs = [ + '/'.join([PACKAGE_NAME, 'glog/vlog_is_on.h']) if PACKAGE_NAME else 'glog/vlog_is_on.h', + ], + cmd = '$(location :gen_sh) < $(<) > $(@)', + tools = [':gen_sh'], + ) From 004fc8cb8ed91d263670f7a96ba36cf32edaad8c Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Sun, 9 Jul 2017 00:38:46 -0400 Subject: [PATCH 2/5] Can build with Bazel now --- BUILD | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 144 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index 7bbd32d..ae99505 100644 --- a/BUILD +++ b/BUILD @@ -1,4 +1,146 @@ licenses(['notice']) -load(':bazel/glog.bzl', 'glog_library') -glog_library() +namespace = 'google' +with_gflags = 1 +with_libunwind = 1 + +cc_library( + name = 'glog', + visibility = [ '//visibility:public' ], + srcs = glob([ + 'src/base/commandlineflags.h', + 'src/base/googleinit.h', + 'src/demangle.cc', + 'src/logging.cc', + 'src/raw_logging.cc', + 'src/signalhandler.cc', + 'src/stacktrace_*-inl.h', + 'src/symbolize.cc', + 'src/utilities.cc', + 'src/vlog_is_on.cc', + ]), + hdrs = [ + 'src/base/mutex.h', + 'src/demangle.h', + 'src/stacktrace.h', + 'src/symbolize.h', + 'src/utilities.h', + 'src/glog/log_severity.h', + ], + includes = [ + 'src', + ], + copts = [ + # Disable warnings that exists in glog. + '-Wno-invalid-noreturn', + '-Wno-sign-compare', + '-Wno-unused-const-variable', + '-Wno-unused-function', + '-Wno-unused-local-typedefs', + '-Wno-unused-variable', + # Inject a C++ namespace. + "-D_START_GOOGLE_NAMESPACE_='namespace %s {'" % namespace, + "-D_END_GOOGLE_NAMESPACE_='}'", + "-DGOOGLE_NAMESPACE='%s'" % namespace, + # Allows src/base/mutex.h to include pthread.h. + '-DHAVE_PTHREAD', + # Allows src/logging.cc to determine the host name. + '-DHAVE_SYS_UTSNAME_H', + # For src/utilities.cc. + '-DHAVE_SYS_SYSCALL_H', + '-DHAVE_SYS_TIME_H', + '-DHAVE_STDINT_H', + '-DHAVE_STRING_H', + # Enable dumping stacktrace upon sigaction. + '-DHAVE_SIGACTION', + # For logging.cc. + '-DHAVE_PREAD', + ] + ([ + # Use gflags to parse CLI arguments. + # NOTE: These parenthesis are necessary. + '-DHAVE_LIB_GFLAGS', + ] if with_gflags else []) + ([ + # Use linunwind to get stacktrace. + '-DHAVE_LIB_UNWIND', + ] if with_libunwind else []), + deps = [ + ':internal_headers', + ] + ([ + '//third_party/gflags', + ] if with_gflags else []) + ([ + '//third_party/libunwind', + ] if with_libunwind else []), +) + + +cc_library( + name = 'internal_headers', + hdrs = [ + ':config_h', + ':logging_h', + ':raw_logging_h', + ':stl_logging_h', + ':vlog_is_on_h', + ], + includes = [ + PACKAGE_NAME, + ] if PACKAGE_NAME else [], +) + + +genrule( + name = 'gen_sh', + outs = [ + 'gen.sh', + ], + cmd = r'''\ +#!/bin/sh +cat > $@ <<"EOF" +sed -e 's/@ac_cv_have_unistd_h@/1/g' \ + -e 's/@ac_cv_have_stdint_h@/1/g' \ + -e 's/@ac_cv_have_systypes_h@/1/g' \ + -e 's/@ac_cv_have_libgflags_h@/1/g' \ + -e 's/@ac_cv_have_uint16_t@/1/g' \ + -e 's/@ac_cv_have___builtin_expect@/1/g' \ + -e 's/@ac_cv_have_.*@/0/g' \ + -e 's/@ac_google_start_namespace@/namespace google {/g' \ + -e 's/@ac_google_end_namespace@/}/g' \ + -e 's/@ac_google_namespace@/google/g' \ + -e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \ + -e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \ + -e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g' +EOF +''', +) + + +genrule( + name = 'config_h', + srcs = [ + 'src/config.h.cmake.in', + ], + outs = [ + '/'.join([PACKAGE_NAME, 'config.h']) if PACKAGE_NAME else 'config.h', + ], + cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)", +) + + +[genrule( + name = '%s_h' % f, + srcs = [ + 'src/glog/%s.h.in' % f, + ], + outs = [ + '/'.join([PACKAGE_NAME, 'glog/%s.h' % f]) \ + if PACKAGE_NAME else 'glog/%s.h' % f, + ], + cmd = '$(location :gen_sh) < $(<) > $(@)', + tools = [':gen_sh'], +) for f in [ + 'vlog_is_on', + 'stl_logging', + 'raw_logging', + 'logging', + ] +] From e6e2e1372aeb3f6ac6ca5f4a3d72bad8dce3c724 Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Thu, 14 Dec 2017 00:51:26 -0800 Subject: [PATCH 3/5] Hide certain header files from the cc_library(). This commit addresses a few issues: 1. No longer leak config.h in a way similar to https://github.com/gflags/gflags/issues/233 The solution of prefixing the path by 'glog_internal' is modified from https://github.com/gflags/gflags/issues/234 2. No longer expose internal headers. 3. Replace PACKAGE_NAME with native.package_name() 4. Uers can choose namespaces via the newly added 'namespace' keyword. 5. Replace glob with explicitly listing of files. 6. Make the genrules more compact using pythonic list construction. --- BUILD | 145 +--------------------------------------------- bazel/glog.bzl | 154 ++++++++++++++++++++----------------------------- 2 files changed, 66 insertions(+), 233 deletions(-) diff --git a/BUILD b/BUILD index ae99505..37fb27b 100644 --- a/BUILD +++ b/BUILD @@ -1,146 +1,5 @@ licenses(['notice']) -namespace = 'google' -with_gflags = 1 -with_libunwind = 1 +load(':bazel/glog.bzl', 'glog_library') -cc_library( - name = 'glog', - visibility = [ '//visibility:public' ], - srcs = glob([ - 'src/base/commandlineflags.h', - 'src/base/googleinit.h', - 'src/demangle.cc', - 'src/logging.cc', - 'src/raw_logging.cc', - 'src/signalhandler.cc', - 'src/stacktrace_*-inl.h', - 'src/symbolize.cc', - 'src/utilities.cc', - 'src/vlog_is_on.cc', - ]), - hdrs = [ - 'src/base/mutex.h', - 'src/demangle.h', - 'src/stacktrace.h', - 'src/symbolize.h', - 'src/utilities.h', - 'src/glog/log_severity.h', - ], - includes = [ - 'src', - ], - copts = [ - # Disable warnings that exists in glog. - '-Wno-invalid-noreturn', - '-Wno-sign-compare', - '-Wno-unused-const-variable', - '-Wno-unused-function', - '-Wno-unused-local-typedefs', - '-Wno-unused-variable', - # Inject a C++ namespace. - "-D_START_GOOGLE_NAMESPACE_='namespace %s {'" % namespace, - "-D_END_GOOGLE_NAMESPACE_='}'", - "-DGOOGLE_NAMESPACE='%s'" % namespace, - # Allows src/base/mutex.h to include pthread.h. - '-DHAVE_PTHREAD', - # Allows src/logging.cc to determine the host name. - '-DHAVE_SYS_UTSNAME_H', - # For src/utilities.cc. - '-DHAVE_SYS_SYSCALL_H', - '-DHAVE_SYS_TIME_H', - '-DHAVE_STDINT_H', - '-DHAVE_STRING_H', - # Enable dumping stacktrace upon sigaction. - '-DHAVE_SIGACTION', - # For logging.cc. - '-DHAVE_PREAD', - ] + ([ - # Use gflags to parse CLI arguments. - # NOTE: These parenthesis are necessary. - '-DHAVE_LIB_GFLAGS', - ] if with_gflags else []) + ([ - # Use linunwind to get stacktrace. - '-DHAVE_LIB_UNWIND', - ] if with_libunwind else []), - deps = [ - ':internal_headers', - ] + ([ - '//third_party/gflags', - ] if with_gflags else []) + ([ - '//third_party/libunwind', - ] if with_libunwind else []), -) - - -cc_library( - name = 'internal_headers', - hdrs = [ - ':config_h', - ':logging_h', - ':raw_logging_h', - ':stl_logging_h', - ':vlog_is_on_h', - ], - includes = [ - PACKAGE_NAME, - ] if PACKAGE_NAME else [], -) - - -genrule( - name = 'gen_sh', - outs = [ - 'gen.sh', - ], - cmd = r'''\ -#!/bin/sh -cat > $@ <<"EOF" -sed -e 's/@ac_cv_have_unistd_h@/1/g' \ - -e 's/@ac_cv_have_stdint_h@/1/g' \ - -e 's/@ac_cv_have_systypes_h@/1/g' \ - -e 's/@ac_cv_have_libgflags_h@/1/g' \ - -e 's/@ac_cv_have_uint16_t@/1/g' \ - -e 's/@ac_cv_have___builtin_expect@/1/g' \ - -e 's/@ac_cv_have_.*@/0/g' \ - -e 's/@ac_google_start_namespace@/namespace google {/g' \ - -e 's/@ac_google_end_namespace@/}/g' \ - -e 's/@ac_google_namespace@/google/g' \ - -e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \ - -e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \ - -e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g' -EOF -''', -) - - -genrule( - name = 'config_h', - srcs = [ - 'src/config.h.cmake.in', - ], - outs = [ - '/'.join([PACKAGE_NAME, 'config.h']) if PACKAGE_NAME else 'config.h', - ], - cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)", -) - - -[genrule( - name = '%s_h' % f, - srcs = [ - 'src/glog/%s.h.in' % f, - ], - outs = [ - '/'.join([PACKAGE_NAME, 'glog/%s.h' % f]) \ - if PACKAGE_NAME else 'glog/%s.h' % f, - ], - cmd = '$(location :gen_sh) < $(<) > $(@)', - tools = [':gen_sh'], -) for f in [ - 'vlog_is_on', - 'stl_logging', - 'raw_logging', - 'logging', - ] -] +glog_library() diff --git a/bazel/glog.bzl b/bazel/glog.bzl index ff2a268..37e5320 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -1,94 +1,96 @@ # Implement a macro glog_library() that the BUILD file can load. -# By default, glog is built with gflags support. You can change this behavior by using -# glog_library(with_gflags=0) + +# By default, glog is built with gflags support. You can change this behavior +# by using glog_library(with_gflags=0) # # This file is inspired by the following sample BUILD files: # https://github.com/google/glog/issues/61 # https://github.com/google/glog/files/393474/BUILD.txt -def glog_library(with_gflags=1): +def glog_library(namespace='google', with_gflags=1): + if native.repository_name() != '@': + gendir = '$(GENDIR)/external/' + native.repository_name().lstrip('@') + else: + gendir = '$(GENDIR)' + native.cc_library( name = 'glog', visibility = [ '//visibility:public' ], srcs = [ + ':config_h', 'src/base/commandlineflags.h', 'src/base/googleinit.h', + 'src/base/mutex.h', 'src/demangle.cc', + 'src/demangle.h', 'src/logging.cc', 'src/raw_logging.cc', 'src/signalhandler.cc', + 'src/stacktrace.h', + 'src/stacktrace_generic-inl.h', + 'src/stacktrace_libunwind-inl.h', + 'src/stacktrace_powerpc-inl.h', + 'src/stacktrace_windows-inl.h', + 'src/stacktrace_x86-inl.h', + 'src/stacktrace_x86_64-inl.h', 'src/symbolize.cc', + 'src/symbolize.h', 'src/utilities.cc', + 'src/utilities.h', 'src/vlog_is_on.cc', ], hdrs = [ - 'src/base/mutex.h', - 'src/demangle.h', - 'src/stacktrace.h', - 'src/symbolize.h', - 'src/utilities.h', + ':logging_h', + ':raw_logging_h', + ':stl_logging_h', + ':vlog_is_on_h', 'src/glog/log_severity.h', ], - includes = [ - 'src', + textual_hdrs = [ ], + strip_include_prefix = 'src', copts = [ - # Disable warnings that exists in glog + # Disable warnings that exists in glog. '-Wno-sign-compare', + '-Wno-unused-function', '-Wno-unused-local-typedefs', - ## Inject google namespace as 'google' - "-D_START_GOOGLE_NAMESPACE_='namespace google {'", + '-Wno-unused-variable', + # Inject a C++ namespace. + "-D_START_GOOGLE_NAMESPACE_='namespace %s {'" % namespace, "-D_END_GOOGLE_NAMESPACE_='}'", - "-DGOOGLE_NAMESPACE='google'", + "-DGOOGLE_NAMESPACE='%s'" % namespace, # Allows src/base/mutex.h to include pthread.h. '-DHAVE_PTHREAD', # Allows src/logging.cc to determine the host name. '-DHAVE_SYS_UTSNAME_H', - # System header files enabler for src/utilities.cc - # Enable system calls from syscall.h + # For src/utilities.cc. '-DHAVE_SYS_SYSCALL_H', - # Enable system calls from sys/time.h '-DHAVE_SYS_TIME_H', '-DHAVE_STDINT_H', '-DHAVE_STRING_H', - # For logging.cc + # Enable dumping stacktrace upon sigaction. + '-DHAVE_SIGACTION', + # For logging.cc. '-DHAVE_PREAD', + + # Include generated header files. + '-I%s/glog_internal' % gendir, ] + [ - '-DHAVE_LIB_GFLAGS' + # Use gflags to parse CLI arguments. + '-DHAVE_LIB_GFLAGS', + ] if with_gflags else [], + deps = [ + '@com_github_gflags_gflags//:gflags', ] if with_gflags else [], - deps = [ ':internal_headers' ] + \ - [ '//external:gflags' ] if with_gflags else [], ) - internal_headers = [ - ':config_h', - ':logging_h', - ':raw_logging_h', - ':stl_logging_h', - ':vlog_is_on_h', - ] - - if PACKAGE_NAME: - native.cc_library( - name = 'internal_headers', - hdrs = internal_headers, - includes = [ - PACKAGE_NAME, - ], - ) - else: - native.cc_library( - name = 'internal_headers', - hdrs = internal_headers, - ) - native.genrule( name = 'gen_sh', outs = [ 'gen.sh', ], - cmd = ''' -#! /bin/sh + cmd = r'''\ +#!/bin/sh cat > $@ <<"EOF" sed -e 's/@ac_cv_have_unistd_h@/1/g' \ -e 's/@ac_cv_have_stdint_h@/1/g' \ @@ -103,7 +105,9 @@ sed -e 's/@ac_cv_have_unistd_h@/1/g' \ -e 's/@ac_cv___attribute___noinline@/__attribute__((noinline))/g' \ -e 's/@ac_cv___attribute___noreturn@/__attribute__((noreturn))/g' \ -e 's/@ac_cv___attribute___printf_4_5@/__attribute__((__format__ (__printf__, 4, 5)))/g' -EOF''') +EOF +''', + ) native.genrule( name = 'config_h', @@ -111,55 +115,25 @@ EOF''') 'src/config.h.cmake.in', ], outs = [ - '/'.join([PACKAGE_NAME, 'config.h']) if PACKAGE_NAME else 'config.h', + 'glog_internal/src/config.h', ], - cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)", + cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $< > $@", ) - native.genrule( - name = 'logging_h', + [native.genrule( + name = '%s_h' % f, srcs = [ - 'src/glog/logging.h.in', + 'src/glog/%s.h.in' % f, ], outs = [ - '/'.join([PACKAGE_NAME, 'glog/logging.h']) if PACKAGE_NAME else 'glog/logging.h', + 'src/glog/%s.h' % f, ], - cmd = '$(location :gen_sh) < $(<) > $(@)', + cmd = '$(location :gen_sh) < $< > $@', tools = [':gen_sh'], - ) - - native.genrule( - name = 'raw_logging_h', - srcs = [ - 'src/glog/raw_logging.h.in', - ], - outs = [ - '/'.join([PACKAGE_NAME, 'glog/raw_logging.h']) if PACKAGE_NAME else 'glog/raw_logging.h', - ], - cmd = '$(location :gen_sh) < $(<) > $(@)', - tools = [':gen_sh'], - ) - - native.genrule( - name = 'stl_logging_h', - srcs = [ - 'src/glog/stl_logging.h.in', - ], - outs = [ - '/'.join([PACKAGE_NAME, 'glog/stl_logging.h']) if PACKAGE_NAME else 'glog/stl_logging.h', - ], - cmd = '$(location :gen_sh) < $(<) > $(@)', - tools = [':gen_sh'], - ) - - native.genrule( - name = 'vlog_is_on_h', - srcs = [ - 'src/glog/vlog_is_on.h.in', - ], - outs = [ - '/'.join([PACKAGE_NAME, 'glog/vlog_is_on.h']) if PACKAGE_NAME else 'glog/vlog_is_on.h', - ], - cmd = '$(location :gen_sh) < $(<) > $(@)', - tools = [':gen_sh'], - ) + ) for f in [ + 'vlog_is_on', + 'stl_logging', + 'raw_logging', + 'logging', + ] + ] From ea458f60b9ebe75b2d72626fa6915583b6648207 Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Thu, 14 Dec 2017 01:03:19 -0800 Subject: [PATCH 4/5] Remove an empty textual_hdrs field. --- bazel/glog.bzl | 2 -- 1 file changed, 2 deletions(-) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 37e5320..e0b633c 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -46,8 +46,6 @@ def glog_library(namespace='google', with_gflags=1): ':vlog_is_on_h', 'src/glog/log_severity.h', ], - textual_hdrs = [ - ], strip_include_prefix = 'src', copts = [ # Disable warnings that exists in glog. From 389a7782e833013d150a54ae0fd6ac161904bd58 Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Thu, 14 Dec 2017 13:45:01 -0800 Subject: [PATCH 5/5] Remove the use of bind() from WORKSPACE. --- WORKSPACE | 5 ----- 1 file changed, 5 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index f5d080e..0c2620f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,8 +3,3 @@ git_repository( remote = "https://github.com/gflags/gflags.git", tag = 'v2.2.1', ) - -bind( - name = "gflags", - actual = "@com_github_gflags_gflags//:gflags", -)