pw_protobuf_compiler: Disable generic .options files upstream
Requires any upstream modules using PWPB options to use the
.pwpb_options file extension.
Change-Id: Iad3da8063a5fc51a76dc18ba26fe4deed1a44195
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/241138
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Docs-Not-Needed: Alexei Frolov <frolv@google.com>
diff --git a/.gn b/.gn
index 3fa8d1e..162ded6 100644
--- a/.gn
+++ b/.gn
@@ -22,6 +22,9 @@
# Default all upstream Pigweed toolchains to enable pw::span asserts.
pw_span_ENABLE_ASSERTS = true
+ # Don't allow a plain .options file extension for upstream pwpb code.
+ pw_protobuf_compiler_NO_GENERIC_OPTIONS_FILES = true
+
pw_build_PIP_CONSTRAINTS =
[ "//pw_env_setup/py/pw_env_setup/virtualenv_setup/constraint.list" ]
diff --git a/pw_i2c/Android.bp b/pw_i2c/Android.bp
index 55020a9..1a9455f 100644
--- a/pw_i2c/Android.bp
+++ b/pw_i2c/Android.bp
@@ -20,11 +20,11 @@
name: "pw_i2c_proto_with_prefix",
defaults: ["pw_rpc_add_prefix_to_proto"],
srcs: [
- "i2c.options",
+ "i2c.pwpb_options",
"i2c.proto",
],
out: [
- "pw_i2c/i2c.options",
+ "pw_i2c/i2c.pwpb_options",
"pw_i2c/i2c.proto",
],
}
diff --git a/pw_i2c/BUILD.bazel b/pw_i2c/BUILD.bazel
index 4b359f3..3ba226e 100644
--- a/pw_i2c/BUILD.bazel
+++ b/pw_i2c/BUILD.bazel
@@ -169,7 +169,7 @@
pw_proto_filegroup(
name = "i2c_proto_and_options",
srcs = ["i2c.proto"],
- options_files = ["i2c.options"],
+ options_files = ["i2c.pwpb_options"],
)
proto_library(
diff --git a/pw_i2c/BUILD.gn b/pw_i2c/BUILD.gn
index 982b5b6..a15c00d 100644
--- a/pw_i2c/BUILD.gn
+++ b/pw_i2c/BUILD.gn
@@ -73,7 +73,7 @@
pw_proto_library("protos") {
sources = [ "i2c.proto" ]
- inputs = [ "i2c.options" ]
+ inputs = [ "i2c.pwpb_options" ]
prefix = "pw_i2c"
}
diff --git a/pw_i2c/CMakeLists.txt b/pw_i2c/CMakeLists.txt
index 39e0c51..3d465c2 100644
--- a/pw_i2c/CMakeLists.txt
+++ b/pw_i2c/CMakeLists.txt
@@ -75,7 +75,7 @@
SOURCES
i2c.proto
INPUTS
- i2c.options
+ i2c.pwpb_options
PREFIX
pw_i2c
)
diff --git a/pw_i2c/i2c.options b/pw_i2c/i2c.pwpb_options
similarity index 100%
rename from pw_i2c/i2c.options
rename to pw_i2c/i2c.pwpb_options
diff --git a/pw_protobuf_compiler/BUILD.gn b/pw_protobuf_compiler/BUILD.gn
index df2ed58..0731042 100644
--- a/pw_protobuf_compiler/BUILD.gn
+++ b/pw_protobuf_compiler/BUILD.gn
@@ -55,7 +55,7 @@
pw_proto_library("pwpb_test_protos") {
sources = [ "pwpb_test_protos/pwpb_test.proto" ]
- inputs = [ "pwpb_test_protos/pwpb_test.options" ]
+ inputs = [ "pwpb_test_protos/pwpb_test.pwpb_options" ]
prefix = "pw_protobuf_compiler"
deps = [ "$dir_pw_protobuf:common_protos" ]
}
diff --git a/pw_protobuf_compiler/CMakeLists.txt b/pw_protobuf_compiler/CMakeLists.txt
index 74a03ee..f62761e 100644
--- a/pw_protobuf_compiler/CMakeLists.txt
+++ b/pw_protobuf_compiler/CMakeLists.txt
@@ -19,7 +19,7 @@
SOURCES
pwpb_test_protos/pwpb_test.proto
INPUTS
- pwpb_test_protos/pwpb_test.options
+ pwpb_test_protos/pwpb_test.pwpb_options
PREFIX
"pw_protobuf_compiler/"
DEPS
diff --git a/pw_protobuf_compiler/pwpb_test_protos/BUILD.bazel b/pw_protobuf_compiler/pwpb_test_protos/BUILD.bazel
index a2babf5..20c3795 100644
--- a/pw_protobuf_compiler/pwpb_test_protos/BUILD.bazel
+++ b/pw_protobuf_compiler/pwpb_test_protos/BUILD.bazel
@@ -24,7 +24,7 @@
pw_proto_filegroup(
name = "pwpb_test_proto_and_options_files",
srcs = ["pwpb_test.proto"],
- options_files = ["pwpb_test.options"],
+ options_files = ["pwpb_test.pwpb_options"],
)
proto_library(
diff --git a/pw_protobuf_compiler/pwpb_test_protos/pwpb_test.options b/pw_protobuf_compiler/pwpb_test_protos/pwpb_test.pwpb_options
similarity index 100%
rename from pw_protobuf_compiler/pwpb_test_protos/pwpb_test.options
rename to pw_protobuf_compiler/pwpb_test_protos/pwpb_test.pwpb_options
diff --git a/pw_rpc/BUILD.bazel b/pw_rpc/BUILD.bazel
index 2035ad9..2b491ea 100644
--- a/pw_rpc/BUILD.bazel
+++ b/pw_rpc/BUILD.bazel
@@ -21,11 +21,18 @@
licenses(["notice"])
+pw_proto_filegroup(
+ name = "benchmark_proto_and_options",
+ srcs = ["benchmark.proto"],
+ options_files = [
+ "benchmark.options",
+ "benchmark.pwpb_options",
+ ],
+)
+
proto_library(
name = "benchmark_proto",
- srcs = [
- "benchmark.proto",
- ],
+ srcs = [":benchmark_proto_and_options"],
)
pw_proto_library(
@@ -470,7 +477,10 @@
pw_proto_filegroup(
name = "echo_proto_and_options",
srcs = ["echo.proto"],
- options_files = ["echo.options"],
+ options_files = [
+ "echo.options",
+ "echo.pwpb_options",
+ ],
)
proto_library(
diff --git a/pw_rpc/BUILD.gn b/pw_rpc/BUILD.gn
index 8dc3e2b..a7073b8 100644
--- a/pw_rpc/BUILD.gn
+++ b/pw_rpc/BUILD.gn
@@ -397,8 +397,10 @@
"internal/packet.proto",
]
inputs = [
- "echo.options",
"benchmark.options",
+ "benchmark.pwpb_options",
+ "echo.options",
+ "echo.pwpb_options",
]
python_package = "py"
prefix = "pw_rpc"
diff --git a/pw_rpc/CMakeLists.txt b/pw_rpc/CMakeLists.txt
index 4b68664..10dd052 100644
--- a/pw_rpc/CMakeLists.txt
+++ b/pw_rpc/CMakeLists.txt
@@ -284,8 +284,10 @@
internal/packet.proto
echo.proto
INPUTS
- echo.options
benchmark.options
+ benchmark.pwpb_options
+ echo.options
+ echo.pwpb_options
PREFIX
pw_rpc
)
diff --git a/pw_rpc/benchmark.pwpb_options b/pw_rpc/benchmark.pwpb_options
new file mode 100644
index 0000000..8f448fe
--- /dev/null
+++ b/pw_rpc/benchmark.pwpb_options
@@ -0,0 +1,17 @@
+// Copyright 2021 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+// The benchmark service is primarily intended for use with the raw API. This
+// file is provided to support testing the PWPB client API.
+pw.rpc.Payload.payload max_size:64
diff --git a/pw_rpc/echo.pwpb_options b/pw_rpc/echo.pwpb_options
new file mode 100644
index 0000000..f610acb
--- /dev/null
+++ b/pw_rpc/echo.pwpb_options
@@ -0,0 +1,15 @@
+// Copyright 2020 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+pw.rpc.EchoMessage.msg max_size:64
diff --git a/pw_rpc_transport/BUILD.bazel b/pw_rpc_transport/BUILD.bazel
index b5b96f3..0ca5885 100644
--- a/pw_rpc_transport/BUILD.bazel
+++ b/pw_rpc_transport/BUILD.bazel
@@ -317,7 +317,7 @@
pw_proto_filegroup(
name = "test_protos_and_options",
srcs = ["internal/test.proto"],
- options_files = ["internal/test.options"],
+ options_files = ["internal/test.pwpb_options"],
)
proto_library(
diff --git a/pw_rpc_transport/BUILD.gn b/pw_rpc_transport/BUILD.gn
index 320e60a..2c34522 100644
--- a/pw_rpc_transport/BUILD.gn
+++ b/pw_rpc_transport/BUILD.gn
@@ -309,6 +309,6 @@
pw_proto_library("test_protos") {
sources = [ "internal/test.proto" ]
- inputs = [ "internal/test.options" ]
+ inputs = [ "internal/test.pwpb_options" ]
prefix = "pw_rpc_transport"
}
diff --git a/pw_rpc_transport/CMakeLists.txt b/pw_rpc_transport/CMakeLists.txt
index 38b047f..db3ecb1 100644
--- a/pw_rpc_transport/CMakeLists.txt
+++ b/pw_rpc_transport/CMakeLists.txt
@@ -215,7 +215,7 @@
SOURCES
internal/test.proto
INPUTS
- internal/test.options
+ internal/test.pwpb_options
PREFIX
pw_rpc_transport
)
diff --git a/pw_rpc_transport/internal/test.options b/pw_rpc_transport/internal/test.pwpb_options
similarity index 100%
rename from pw_rpc_transport/internal/test.options
rename to pw_rpc_transport/internal/test.pwpb_options
diff --git a/pw_software_update/BUILD.gn b/pw_software_update/BUILD.gn
index f6c209b..fd71016 100644
--- a/pw_software_update/BUILD.gn
+++ b/pw_software_update/BUILD.gn
@@ -59,7 +59,10 @@
"tuf.proto",
"update_bundle.proto",
]
- inputs = [ "bundled_update.options" ]
+ inputs = [
+ "bundled_update.pwpb_options",
+ "bundled_update.options",
+ ]
prefix = "pw_software_update"
python_package = "py"
}
diff --git a/pw_software_update/bundled_update.pwpb_options b/pw_software_update/bundled_update.pwpb_options
new file mode 100644
index 0000000..9ca6d6f
--- /dev/null
+++ b/pw_software_update/bundled_update.pwpb_options
@@ -0,0 +1,17 @@
+// Copyright 2021 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+pw.software_update.BundledUpdateStatus.bundle_filename max_size:32
+pw.software_update.BundledUpdateStatus.note max_size:32
+pw.software_update.StartRequest.bundle_filename max_size:32