Skip to content

Commit

Permalink
Merge branch 'main' into b/309719013
Browse files Browse the repository at this point in the history
  • Loading branch information
bajajneha27 authored May 24, 2024
2 parents 99a832e + 45ed21b commit f69266a
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 113 deletions.
8 changes: 4 additions & 4 deletions bazel/development0.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def gl_cpp_development0(name = None):
http_archive,
name = "com_google_benchmark",
urls = [
"https://storage.googleapis.com/cloud-cpp-community-archive/com_google_benchmark/v1.8.3.tar.gz",
"https://github.com/google/benchmark/archive/v1.8.3.tar.gz",
"https://storage.googleapis.com/cloud-cpp-community-archive/com_google_benchmark/v1.8.4.tar.gz",
"https://github.com/google/benchmark/archive/v1.8.4.tar.gz",
],
sha256 = "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce",
strip_prefix = "benchmark-1.8.3",
sha256 = "3e7059b6b11fb1bbe28e33e02519398ca94c1818874ebed18e504dc6f709be45",
strip_prefix = "benchmark-1.8.4",
)

# An XML parser and generator, this is only used in //docfx.
Expand Down
8 changes: 4 additions & 4 deletions bazel/workspace0.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ def gl_cpp_workspace0(name = None):
http_archive,
name = "com_google_protobuf",
urls = [
"https://storage.googleapis.com/cloud-cpp-community-archive/com_google_protobuf/v26.1.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz",
"https://storage.googleapis.com/cloud-cpp-community-archive/com_google_protobuf/v27.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz",
],
sha256 = "4fc5ff1b2c339fb86cd3a25f0b5311478ab081e65ad258c6789359cd84d421f8",
strip_prefix = "protobuf-26.1",
sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa",
strip_prefix = "protobuf-27.0",
)

# Load BoringSSL. This could be automatically loaded by gRPC. But as of
Expand Down
4 changes: 2 additions & 2 deletions ci/cloudbuild/dockerfiles/centos-7.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz |
ldconfig && cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -179,7 +179,7 @@ RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \

# Download and compile Google microbenchmark support library:
WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.4.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-centos-7.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz |

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-debian-bullseye.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ RUN apt-get update && \

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-debian-buster.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-opensuse-leap.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ RUN curl -fsSL https://github.com/google/re2/archive/2024-05-01.tar.gz | \

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-rockylinux-8.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz |

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-rockylinux-9.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz |

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-ubuntu-focal.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz |

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/dockerfiles/demo-ubuntu-jammy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz |

# ```bash
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
4 changes: 2 additions & 2 deletions ci/cloudbuild/dockerfiles/fedora-latest-cmake.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
ldconfig && cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.4.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
Expand Down Expand Up @@ -129,7 +129,7 @@ RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \
ldconfig && cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
4 changes: 2 additions & 2 deletions ci/cloudbuild/dockerfiles/fedora-latest-cxx14.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.4.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_CXX_STANDARD=14 \
Expand Down Expand Up @@ -135,7 +135,7 @@ RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \
cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_CXX_STANDARD=14 \
Expand Down
4 changes: 2 additions & 2 deletions ci/cloudbuild/dockerfiles/fedora-latest-cxx20.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.4.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_CXX_STANDARD=20 \
Expand Down Expand Up @@ -137,7 +137,7 @@ RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \
cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_CXX_STANDARD=20 \
Expand Down
4 changes: 2 additions & 2 deletions ci/cloudbuild/dockerfiles/ubuntu-20.04-install.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build/benchmark
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.4.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
Expand Down Expand Up @@ -121,7 +121,7 @@ RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \
cd /var/tmp && rm -fr build

WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
16 changes: 8 additions & 8 deletions doc/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Google Cloud Platform proto files:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -640,7 +640,7 @@ Google Cloud Platform proto files:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -806,7 +806,7 @@ Google Cloud Platform proto files:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -1132,7 +1132,7 @@ to build from source:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -1315,7 +1315,7 @@ to build from source:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -1485,7 +1485,7 @@ Google Cloud Platform proto files:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -1702,7 +1702,7 @@ install Protobuf (and any downstream packages) from source.

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -1932,7 +1932,7 @@ Google Cloud Platform proto files:

```bash
mkdir -p $HOME/Downloads/protobuf && cd $HOME/Downloads/protobuf
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz | \
curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v27.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
87 changes: 10 additions & 77 deletions google/cloud/securitycenter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@google_cloud_cpp//bazel:gapic.bzl", "cc_gapic_library")

package(default_visibility = ["//visibility:private"])

licenses(["notice"]) # Apache 2.0
Expand All @@ -22,82 +24,13 @@ service_dirs = [
"v2/",
]

code_glob = [d + i + f for d in service_dirs for i in [
"",
"internal/",
] for f in [
"*.h",
"*.cc",
]]

sources_glob = [d + "internal/*_sources.cc" for d in service_dirs]

filegroup(
name = "srcs",
srcs = glob(sources_glob),
)

filegroup(
name = "hdrs",
srcs = glob(
include = code_glob,
exclude = sources_glob,
),
)

filegroup(
name = "public_hdrs",
srcs = glob([d + "*.h" for d in service_dirs]),
visibility = ["//:__pkg__"],
)

filegroup(
name = "mocks",
srcs = glob([d + "mocks/*.h" for d in service_dirs]),
visibility = ["//:__pkg__"],
)

cc_library(
name = "google_cloud_cpp_securitycenter",
srcs = [":srcs"],
hdrs = [":hdrs"],
# Cannot compile on Windows - the protos have enum values that
# conflict with some system macros.
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["//:__pkg__"],
deps = [
"//:common",
"//:grpc_utils",
"@com_google_googleapis//google/cloud/securitycenter/v1:securitycenter_cc_grpc",
"@com_google_googleapis//google/cloud/securitycenter/v2:securitycenter_cc_grpc",
],
)
googleapis_deps = [
"@com_google_googleapis//google/cloud/securitycenter/v1:securitycenter_cc_grpc",
"@com_google_googleapis//google/cloud/securitycenter/v2:securitycenter_cc_grpc",
]

cc_library(
name = "google_cloud_cpp_securitycenter_mocks",
hdrs = [":mocks"],
# Cannot compile on Windows - the protos have enum values that
# conflict with some system macros.
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["//:__pkg__"],
deps = [
":google_cloud_cpp_securitycenter",
"@com_google_googletest//:gtest",
],
cc_gapic_library(
name = "securitycenter",
googleapis_deps = googleapis_deps,
service_dirs = service_dirs,
)

[cc_test(
name = sample.replace("/", "_").replace(".cc", ""),
srcs = [sample],
tags = ["integration-test"],
deps = [
"//:securitycenter",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
],
) for sample in glob([d + "samples/*.cc" for d in service_dirs])]
4 changes: 2 additions & 2 deletions google/cloud/securitycenter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# limitations under the License.
# ~~~

if (WIN32)
if (WIN32 AND (Protobuf_VERSION VERSION_LESS 27.0))
message(
WARNING "Cannot build google/cloud/securitycenter on Windows"
" - the protos have enum names that conflict with some system"
" macros.")
" macros. Update to protobuf >= 27.0.")
return()
endif ()

Expand Down

0 comments on commit f69266a

Please sign in to comment.