From ee62862c3dd52634ac5ec722b98b8a0c994e7155 Mon Sep 17 00:00:00 2001 From: jingwen Date: Mon, 9 Jul 2018 07:42:16 -0700 Subject: Sync jmmv@'s table styles for the docs.bazel.build site. Sources: https://github.com/bazelbuild/bazel-blog/commit/846478d6943162f4c4d7d50001069e0ca7b2ec28 https://github.com/bazelbuild/bazel-blog/commit/aacaa25314678c08772372b3d46697f7963bb201 RELNOTES: None. PiperOrigin-RevId: 203763253 --- WORKSPACE | 12 ++--- site/_config.yml | 2 + site/_sass/style.scss | 6 +++ site/_sass/tables.scss | 63 ++++++++++++++++++++++ site/css/main.scss | 1 + .../devtools/build/lib/buildeventservice/BUILD | 2 +- src/main/protobuf/BUILD | 4 +- .../com/google/devtools/build/lib/rules/cpp/BUILD | 2 +- .../shell/integration/bazel_command_log_test.sh | 18 ------- src/test/shell/testenv.sh | 2 +- 10 files changed, 83 insertions(+), 29 deletions(-) create mode 100644 site/_sass/tables.scss diff --git a/WORKSPACE b/WORKSPACE index 13b6cee0ff..6ac9c6faa7 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -69,20 +69,20 @@ bind( new_local_repository( name = "com_google_protobuf", - build_file = "./third_party/protobuf/3.6.0/BUILD", - path = "./third_party/protobuf/3.6.0/", + build_file = "./third_party/protobuf/3.4.0/BUILD", + path = "./third_party/protobuf/3.4.0/", ) new_local_repository( name = "com_google_protobuf_cc", - build_file = "./third_party/protobuf/3.6.0/BUILD", - path = "./third_party/protobuf/3.6.0/", + build_file = "./third_party/protobuf/3.4.0/BUILD", + path = "./third_party/protobuf/3.4.0/", ) new_local_repository( name = "com_google_protobuf_java", - build_file = "./third_party/protobuf/3.6.0/com_google_protobuf_java.BUILD", - path = "./third_party/protobuf/3.6.0/", + build_file = "./third_party/protobuf/3.4.0/com_google_protobuf_java.BUILD", + path = "./third_party/protobuf/3.4.0/", ) new_local_repository( diff --git a/site/_config.yml b/site/_config.yml index ef23bc0765..17986c7564 100644 --- a/site/_config.yml +++ b/site/_config.yml @@ -1,5 +1,7 @@ destination: production markdown: redcarpet +redcarpet: + extensions: ["tables"] paginate: 10 highlighter: pygments sass: diff --git a/site/_sass/style.scss b/site/_sass/style.scss index 9784b7e420..33f75e36d9 100644 --- a/site/_sass/style.scss +++ b/site/_sass/style.scss @@ -16,6 +16,12 @@ $text-color: #444; $vpad: 20px; +$table-bg: #fff; +$table-cell-padding: 5px; +$table-border-color: $bazel-green; +$text-muted: $color-on-bazel-green; +$line-height-base: 20px; +$line-height-computed: 20px; html { position: relative; diff --git a/site/_sass/tables.scss b/site/_sass/tables.scss new file mode 100644 index 0000000000..fe4edd7cf0 --- /dev/null +++ b/site/_sass/tables.scss @@ -0,0 +1,63 @@ +// Bootstrap requires tables to carry a .table class in order for styling to +// be applied. However, redcarpet emits table elements without the class and +// it is not possible to customize it. +// +// Ideally, we would use a SASS directive to make the table element inherit +// the formatting defined by the bootstrap templates... but we cannot do so +// at the moment because we don't build bootstrap ourselves from its SASS +// sources. Therefore, this file just borrows the minimal amount of code +// from bootstrap 3.3.7 to render tables nicely. + +caption { + padding-top: $table-cell-padding; + padding-bottom: $table-cell-padding; + color: $text-muted; + text-align: left; +} + +th { + text-align: left; +} + +// Baseline styles + +table { + background-color: $table-bg; + width: 100%; + max-width: 100%; + margin-bottom: $line-height-computed; + // Cells + > thead, + > tbody, + > tfoot { + > tr { + > th, + > td { + padding: $table-cell-padding; + line-height: $line-height-base; + vertical-align: top; + border-top: 1px solid $table-border-color; + } + } + } + // Bottom align for column headings + > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid $table-border-color; + } + // Remove top border from thead by default + > caption + thead, + > colgroup + thead, + > thead:first-child { + > tr:first-child { + > th, + > td { + border-top: 0; + } + } + } + // Account for multiple tbody instances + > tbody + tbody { + border-top: 2px solid $table-border-color; + } +} diff --git a/site/css/main.scss b/site/css/main.scss index 402b94f682..bc6a3b3310 100644 --- a/site/css/main.scss +++ b/site/css/main.scss @@ -7,5 +7,6 @@ @import "sidebar.scss"; @import "docs.scss"; @import "be.scss"; +@import "tables.scss"; @import "syntax.scss"; diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD b/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD index a8adee5f2b..10db971120 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD +++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BUILD @@ -29,7 +29,7 @@ java_library( "//third_party/grpc:grpc-jar", "@com_google_protobuf//:protobuf_java", "@com_google_protobuf//:protobuf_java_util", - "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:well_known_types_any_proto", "@googleapis//:google_devtools_build_v1_build_events_java_proto", "@googleapis//:google_devtools_build_v1_build_status_java_proto", "@googleapis//:google_devtools_build_v1_publish_build_event_java_proto", diff --git a/src/main/protobuf/BUILD b/src/main/protobuf/BUILD index fbb1374348..85aaa24a67 100644 --- a/src/main/protobuf/BUILD +++ b/src/main/protobuf/BUILD @@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"]) load("//tools/build_rules:genproto.bzl", "cc_grpc_library") load("//tools/build_rules:utilities.bzl", "java_library_srcs") -load("//third_party/protobuf/3.6.0:protobuf.bzl", "py_proto_library") +load("//third_party/protobuf/3.4.0:protobuf.bzl", "py_proto_library") load("//third_party/grpc:build_defs.bzl", "java_grpc_library") exports_files( @@ -148,7 +148,7 @@ proto_library( name = "remote_execution_log_proto", srcs = ["remote_execution_log.proto"], deps = [ - "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:well_known_types_timestamp_proto", "@googleapis//:google_bytestream_bytestream_proto", "@googleapis//:google_devtools_remoteexecution_v1test_remote_execution_proto", "@googleapis//:google_longrunning_operations_proto", diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD b/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD index 8fa0c86c49..fe502fd67e 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/BUILD @@ -83,7 +83,7 @@ java_library( "//third_party:junit4", "//third_party:truth", "//third_party/java/dd_plist", - "//third_party/protobuf:protobuf_java", + "//third_party/protobuf/3.4.0:protobuf_java", ], ) diff --git a/src/test/shell/integration/bazel_command_log_test.sh b/src/test/shell/integration/bazel_command_log_test.sh index 3e7443c353..91294daa89 100755 --- a/src/test/shell/integration/bazel_command_log_test.sh +++ b/src/test/shell/integration/bazel_command_log_test.sh @@ -46,29 +46,12 @@ function strip_lines_from_bazel_cc() { echo "$clean_log" > $TEST_log } -function strip_protobuf_unsafe_warning() { - # TODO: Protobuf triggers illegal reflective access warning in JDK 9. - # Remove this workaround when protobuf fixes this. - # See https://github.com/google/protobuf/issues/3781 - clean_log=$(\ - sed \ - -e "/^WARNING: An illegal reflective access operation has occurred/d" \ - -e "/^WARNING: Illegal reflective access by com\.google\.protobuf\.UnsafeUtil /d" \ - -e "/^WARNING: Please consider reporting this to the maintainers of com\.google\.protobuf\.UnsafeUtil/d" \ - -e "/^WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations/d" \ - -e "/^WARNING: All illegal access operations will be denied in a future release/d" \ - $TEST_log) - - echo "$clean_log" > $TEST_log -} - function test_batch_mode() { # capture stdout/stderr in $TEST_log bazel --batch info >&$TEST_log || fail "Expected success" # strip extra lines printed by bazel.cc strip_lines_from_bazel_cc - strip_protobuf_unsafe_warning # compare $TEST_log with command.log assert_equals "" "$(diff $TEST_log $log 2>&1)" @@ -85,7 +68,6 @@ function test_batch_mode_with_logging_flag() { # strip extra lines printed by bazel.cc strip_lines_from_bazel_cc - strip_protobuf_unsafe_warning # compare $TEST_log with command.log assert_equals "" "$(diff $TEST_log $log 2>&1)" diff --git a/src/test/shell/testenv.sh b/src/test/shell/testenv.sh index c4a0c5599d..b2f6e24147 100755 --- a/src/test/shell/testenv.sh +++ b/src/test/shell/testenv.sh @@ -115,7 +115,7 @@ if [ "${MACHINE_TYPE}" = 's390x' ]; then fi # Requires //third_party/protobuf:protoc -protoc_compiler="${BAZEL_RUNFILES}/third_party/protobuf/3.6.0/protoc" +protoc_compiler="${BAZEL_RUNFILES}/third_party/protobuf/3.4.0/protoc" if [ -z ${RUNFILES_MANIFEST_ONLY+x} ]; then junit_jar="${BAZEL_RUNFILES}/third_party/junit/junit-*.jar" -- cgit v1.2.3