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

s2a: Use protos published under com.google.s2a.proto.v2. #11908

Merged
merged 5 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava:33.3.1-android",
"com.google.re2j:re2j:1.8",
"com.google.s2a.proto.v2:s2a-proto:0.1.1",
"com.google.truth:truth:1.4.2",
"com.squareup.okhttp:okhttp:2.7.5",
"com.squareup.okio:okio:2.10.0", # 3.0+ needs swapping to -jvm; need work to avoid flag-day
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/sync-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ curl -Ls https://github.com/grpc/grpc-proto/archive/master.tar.gz | tar xz -C "$
base="$tmpdir/grpc-proto-master"

# Copy protos in 'src/main/proto' from grpc-proto for these projects
for project in alts grpclb services s2a rls interop-testing; do
for project in alts grpclb services rls interop-testing; do
while read -r proto; do
[ -f "$base/$proto" ] && cp "$base/$proto" "$project/src/main/proto/$proto"
echo "$proto"
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.
protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }
re2j = "com.google.re2j:re2j:1.8"
robolectric = "org.robolectric:robolectric:4.14.1"
s2a-proto = "com.google.s2a.proto.v2:s2a-proto:0.1.1"
signature-android = "net.sf.androidscents.signature:android-api-level-21:5.0.1_r2"
signature-java = "org.codehaus.mojo.signature:java18:1.0"
# 11.0.0+ require Java 17+
Expand Down
1 change: 1 addition & 0 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava:33.3.1-android",
"com.google.re2j:re2j:1.8",
"com.google.s2a.proto.v2:s2a-proto:0.1.1",
"com.google.truth:truth:1.4.2",
"com.squareup.okhttp:okhttp:2.7.5",
"com.squareup.okio:okio:2.10.0", # 3.0+ needs swapping to -jvm; need work to avoid flag-day
Expand Down
73 changes: 3 additions & 70 deletions s2a/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:java_grpc_library.bzl", "java_grpc_library")
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
Expand All @@ -25,9 +23,9 @@ java_library(
name = "s2a_identity",
srcs = ["src/main/java/io/grpc/s2a/internal/handshaker/S2AIdentity.java"],
deps = [
":common_java_proto",
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("com.google.s2a.proto.v2:s2a-proto"),
],
)

Expand Down Expand Up @@ -58,18 +56,16 @@ java_library(
],
deps = [
":token_manager",
":common_java_proto",
":s2a_channel_pool",
":s2a_identity",
":s2a_java_proto",
":s2a_java_grpc_proto",
"//api",
"//core:internal",
"//netty",
"//stub",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("com.google.s2a.proto.v2:s2a-proto"),
artifact("org.checkerframework:checker-qual"),
"@com_google_protobuf//:protobuf_java",
artifact("io.netty:netty-common"),
Expand All @@ -94,67 +90,4 @@ java_library(
artifact("com.google.guava:guava"),
artifact("org.checkerframework:checker-qual"),
],
)

# bazel only accepts proto import with absolute path.
genrule(
name = "protobuf_imports",
srcs = glob(["src/main/proto/grpc/gcp/s2a/*.proto"]),
outs = [
"protobuf_out/grpc/gcp/s2a/s2a.proto",
"protobuf_out/grpc/gcp/s2a/s2a_context.proto",
"protobuf_out/grpc/gcp/s2a/common.proto",
],
cmd = "for fname in $(SRCS); do " +
"sed 's,import \",import \"s2a/protobuf_out/,g' $$fname > " +
"$(@D)/protobuf_out/grpc/gcp/s2a/$$(basename $$fname); done",
)

proto_library(
name = "common_proto",
srcs = [
"protobuf_out/grpc/gcp/s2a/common.proto",
],
)

proto_library(
name = "s2a_context_proto",
srcs = [
"protobuf_out/grpc/gcp/s2a/s2a_context.proto",
],
deps = [
":common_proto",
],
)

proto_library(
name = "s2a_proto",
srcs = [
"protobuf_out/grpc/gcp/s2a/s2a.proto",
],
deps = [
":common_proto",
":s2a_context_proto",
],
)

java_proto_library(
name = "s2a_java_proto",
deps = [":s2a_proto"],
)

java_proto_library(
name = "s2a_context_java_proto",
deps = [":s2a_context_proto"],
)

java_proto_library(
name = "common_java_proto",
deps = [":common_proto"],
)

java_grpc_library(
name = "s2a_java_grpc_proto",
srcs = [":s2a_proto"],
deps = [":s2a_java_proto"],
)
)
1 change: 1 addition & 0 deletions s2a/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
description = "gRPC: S2A"

dependencies {
implementation libraries.s2a.proto

api project(':grpc-api')
implementation project(':grpc-stub'),
Expand Down
Loading
Loading