Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmake support to protocolbuffers/cpp plugins to v25 #1577

Merged
merged 25 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ab0acb5
Add cmake support retroactive to v25.0 and squash layers
smaye81 Nov 9, 2024
ce1d9da
Whitespace
smaye81 Nov 9, 2024
06efbdd
Patch 25.0-25.2 to ignore editions
smaye81 Nov 12, 2024
5d0667e
Merge branch 'main' into sayers/cpp_to_25
smaye81 Nov 13, 2024
1e76052
Update to latest image
smaye81 Nov 26, 2024
b86d1fd
Update to latest base image
smaye81 Nov 26, 2024
c03363c
Bump the distroless group in /.github/docker with 6 updates (#1587)
dependabot[bot] Nov 13, 2024
14db30e
Bump bazel-public/bazel from 7.4.0 to 7.4.1 in /.github/docker (#1589)
dependabot[bot] Nov 13, 2024
704b1b6
Bump dotnet/sdk from 8.0.403-bookworm-slim to 8.0.404-bookworm-slim i…
dependabot[bot] Nov 14, 2024
8151e01
Update protocolbuffers/go v1.35.2 (#1591)
app-token-plugins[bot] Nov 14, 2024
1f253ee
Bump `protocolbuffers/[email protected]` to `netstandard2.0` (#1592)
saquibmian Nov 15, 2024
1eb1b88
Bump github.com/bufbuild/buf from 1.46.0 to 1.47.2 (#1594)
dependabot[bot] Nov 18, 2024
6f15a34
Update grpc to v1.68.0 (#1593)
app-token-plugins[bot] Nov 18, 2024
4429a22
Update community/stephenh-ts-proto to v2.3.0 (#1595)
pkwarren Nov 19, 2024
10ad6cd
Deprecate connectrpc/es and connectrpc/query-es (#1597)
mfridman Nov 20, 2024
c3d99d8
Add connectrpc/query-es v2.0.0 (#1598)
mfridman Nov 20, 2024
3d91f23
Disable protoc-gen-connect-es updates (#1599)
mfridman Nov 20, 2024
54d3f66
Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1601)
dependabot[bot] Nov 25, 2024
2f49d4a
Update grpc-ecosystem plugins to v2.24.0 (#1602)
mfridman Nov 26, 2024
905a24e
Disable protoc-gen-bq-schema sync (#1604)
mfridman Nov 26, 2024
a0a79d3
Add protoc-gen-bq-schema v2.0.1 (#1605)
mfridman Nov 26, 2024
a411150
Squash layers and update images
smaye81 Nov 26, 2024
3546f75
Merge branch 'main' into sayers/cpp_to_25
smaye81 Nov 26, 2024
304e1a7
Revert 26.1 plugins and squash layers/upgrade to Debian 12 in 25.0 pl…
smaye81 Nov 27, 2024
c0c6eff
Bump additional base images
pkwarren Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/protocolbuffers/cpp/v25.0/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!BUILD
!cpp.cc
!disable_cpp_editions.patch
!Dockerfile
15 changes: 10 additions & 5 deletions plugins/protocolbuffers/cpp/v25.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5
FROM debian:bullseye-20231030 AS build
# syntax=docker/dockerfile:1.10
FROM debian:bookworm-20241111 AS build

ARG TARGETARCH

Expand All @@ -16,9 +16,14 @@ RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/rele
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD cpp.cc plugins/
RUN bazel build '//plugins:protoc-gen-cpp.stripped'
COPY --link disable_cpp_editions.patch .
RUN git apply < disable_cpp_editions.patch \
&& bazel build '//plugins:protoc-gen-cpp.stripped'

FROM gcr.io/distroless/cc-debian11
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
FROM gcr.io/distroless/cc-debian12:latest@sha256:2fb69596e692931f909c4c69ab09e50608959eaf8898c44fa64db741a23588b0 AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=build --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
USER nobody
ENTRYPOINT ["/protoc-gen-cpp"]
2 changes: 2 additions & 0 deletions plugins/protocolbuffers/cpp/v25.0/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ output_languages:
- cpp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v25.0/LICENSE
registry:
cmake: {}
20 changes: 20 additions & 0 deletions plugins/protocolbuffers/cpp/v25.0/disable_cpp_editions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/src/google/protobuf/compiler/cpp/generator.h b/src/google/protobuf/compiler/cpp/generator.h
index 64f334d5b..fd6e08e84 100644
--- a/src/google/protobuf/compiler/cpp/generator.h
+++ b/src/google/protobuf/compiler/cpp/generator.h
@@ -70,14 +70,7 @@ class PROTOC_EXPORT CppGenerator : public CodeGenerator {
std::string* error) const override;

uint64_t GetSupportedFeatures() const override {
- return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS;
- }
-
- Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
- Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
-
- std::vector<const FieldDescriptor*> GetFeatureExtensions() const override {
- return {GetExtensionReflection(pb::cpp)};
+ return FEATURE_PROTO3_OPTIONAL;
}

private:
1 change: 1 addition & 0 deletions plugins/protocolbuffers/cpp/v25.1/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!BUILD
!cpp.cc
!disable_cpp_editions.patch
!Dockerfile
15 changes: 10 additions & 5 deletions plugins/protocolbuffers/cpp/v25.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5
FROM debian:bullseye-20231030 AS build
# syntax=docker/dockerfile:1.10
FROM debian:bookworm-20241111 AS build

ARG TARGETARCH

Expand All @@ -16,9 +16,14 @@ RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/rele
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD cpp.cc plugins/
RUN bazel build '//plugins:protoc-gen-cpp.stripped'
COPY --link disable_cpp_editions.patch .
RUN git apply < disable_cpp_editions.patch \
&& bazel build '//plugins:protoc-gen-cpp.stripped'
pkwarren marked this conversation as resolved.
Show resolved Hide resolved

FROM gcr.io/distroless/cc-debian11
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
FROM gcr.io/distroless/cc-debian12:latest@sha256:2fb69596e692931f909c4c69ab09e50608959eaf8898c44fa64db741a23588b0 AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=build --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
USER nobody
ENTRYPOINT ["/protoc-gen-cpp"]
2 changes: 2 additions & 0 deletions plugins/protocolbuffers/cpp/v25.1/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ output_languages:
- cpp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v25.1/LICENSE
registry:
cmake: {}
20 changes: 20 additions & 0 deletions plugins/protocolbuffers/cpp/v25.1/disable_cpp_editions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/src/google/protobuf/compiler/cpp/generator.h b/src/google/protobuf/compiler/cpp/generator.h
index 64f334d5b..fd6e08e84 100644
--- a/src/google/protobuf/compiler/cpp/generator.h
+++ b/src/google/protobuf/compiler/cpp/generator.h
@@ -70,14 +70,7 @@ class PROTOC_EXPORT CppGenerator : public CodeGenerator {
std::string* error) const override;

uint64_t GetSupportedFeatures() const override {
- return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS;
- }
-
- Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
- Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
-
- std::vector<const FieldDescriptor*> GetFeatureExtensions() const override {
- return {GetExtensionReflection(pb::cpp)};
+ return FEATURE_PROTO3_OPTIONAL;
}

private:
1 change: 1 addition & 0 deletions plugins/protocolbuffers/cpp/v25.2/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!BUILD
!cpp.cc
!disable_cpp_editions.patch
!Dockerfile
15 changes: 10 additions & 5 deletions plugins/protocolbuffers/cpp/v25.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5
FROM debian:bookworm-20231218 AS build
# syntax=docker/dockerfile:1.10
FROM debian:bookworm-20241111 AS build

ARG TARGETARCH

Expand All @@ -16,9 +16,14 @@ RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/rele
&& rm protoc.tar.gz
RUN bazel build '//:protoc_lib'
COPY --link BUILD cpp.cc plugins/
RUN bazel build '//plugins:protoc-gen-cpp.stripped'
COPY --link disable_cpp_editions.patch .
RUN git apply < disable_cpp_editions.patch \
&& bazel build '//plugins:protoc-gen-cpp.stripped'

FROM gcr.io/distroless/cc-debian12:latest@sha256:6714977f9f02632c31377650c15d89a7efaebf43bab0f37c712c30fc01edb973
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
FROM gcr.io/distroless/cc-debian12:latest@sha256:2fb69596e692931f909c4c69ab09e50608959eaf8898c44fa64db741a23588b0 AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=build --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
USER nobody
ENTRYPOINT ["/protoc-gen-cpp"]
2 changes: 2 additions & 0 deletions plugins/protocolbuffers/cpp/v25.2/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ output_languages:
- cpp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v25.2/LICENSE
registry:
cmake: {}
20 changes: 20 additions & 0 deletions plugins/protocolbuffers/cpp/v25.2/disable_cpp_editions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/src/google/protobuf/compiler/cpp/generator.h b/src/google/protobuf/compiler/cpp/generator.h
index 64f334d5b..fd6e08e84 100644
--- a/src/google/protobuf/compiler/cpp/generator.h
+++ b/src/google/protobuf/compiler/cpp/generator.h
@@ -70,14 +70,7 @@ class PROTOC_EXPORT CppGenerator : public CodeGenerator {
std::string* error) const override;

uint64_t GetSupportedFeatures() const override {
- return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS;
- }
-
- Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
- Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
-
- std::vector<const FieldDescriptor*> GetFeatureExtensions() const override {
- return {GetExtensionReflection(pb::cpp)};
+ return FEATURE_PROTO3_OPTIONAL;
}

private:
6 changes: 3 additions & 3 deletions plugins/protocolbuffers/cpp/v25.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.7
FROM debian:bookworm-20240211 AS build
# syntax=docker/dockerfile:1.10
FROM debian:bookworm-20241111 AS build

ARG TARGETARCH

Expand All @@ -20,7 +20,7 @@ COPY --link disable_cpp_editions.patch .
RUN git apply < disable_cpp_editions.patch \
&& bazel build '//plugins:protoc-gen-cpp.stripped'

FROM gcr.io/distroless/cc-debian12:latest@sha256:e1065a1d58800a7294f74e67c32ec4146d09d6cbe471c1fa7ed456b2d2bf06e0 AS base
FROM gcr.io/distroless/cc-debian12:latest@sha256:2fb69596e692931f909c4c69ab09e50608959eaf8898c44fa64db741a23588b0 AS base

FROM scratch
COPY --link --from=base / /
Expand Down
2 changes: 2 additions & 0 deletions plugins/protocolbuffers/cpp/v25.3/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ output_languages:
- cpp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v25.3/LICENSE
registry:
cmake: {}
11 changes: 7 additions & 4 deletions plugins/protocolbuffers/cpp/v26.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.5
FROM debian:bookworm-20240311 AS build
# syntax=docker/dockerfile:1.10
FROM debian:bookworm-20241111 AS build

ARG TARGETARCH

Expand All @@ -18,7 +18,10 @@ RUN bazel build '//:protoc_lib'
COPY --link BUILD cpp.cc plugins/
RUN bazel build '//plugins:protoc-gen-cpp.stripped'

FROM gcr.io/distroless/cc-debian12:latest@sha256:e6ae66a5a343d7112167f9117c4e630cfffcd80db44e44302759ec13ddd2d22b
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
FROM gcr.io/distroless/cc-debian12:latest@sha256:2fb69596e692931f909c4c69ab09e50608959eaf8898c44fa64db741a23588b0 AS base

FROM scratch
COPY --link --from=base / /
COPY --link --from=build --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
USER nobody
ENTRYPOINT ["/protoc-gen-cpp"]
2 changes: 2 additions & 0 deletions plugins/protocolbuffers/cpp/v26.0/buf.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ output_languages:
- cpp
spdx_license_id: BSD-3-Clause
license_url: https://github.com/protocolbuffers/protobuf/blob/v26.0/LICENSE
registry:
cmake: {}