From 22f11700bc7b352308a3f49ba99639f9de8aaffa Mon Sep 17 00:00:00 2001 From: Sandy Zhang <sandyzhang@google.com> Date: Tue, 19 Mar 2024 15:09:00 -0700 Subject: [PATCH 1/2] Move java_features.proto to java/core/srce/main/resources This also fixes maven to package this correctly as google/protobuf/java_features.proto (same dir as WKT/descriptor.proto) instead of com/google/protobuf/java_features.proto. Fixes https://github.com/protocolbuffers/protobuf/issues/16155 PiperOrigin-RevId: 617307475 --- java/core/BUILD.bazel | 8 ++++---- java/core/generate-sources-build.xml | 2 +- java/core/pom.xml | 2 +- .../com => resources}/google/protobuf/java_features.proto | 0 java/pom.xml | 2 +- .../editions/golden/editions_transform_proto2.proto | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename java/core/src/main/{java/com => resources}/google/protobuf/java_features.proto (100%) diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel index 92d9982815bf5..9999fdf92dc34 100644 --- a/java/core/BUILD.bazel +++ b/java/core/BUILD.bazel @@ -168,15 +168,15 @@ protobuf_java_library( proto_library( name = "java_features_proto", - srcs = ["src/main/java/com/google/protobuf/java_features.proto"], - strip_import_prefix = "/java/core/src/main/java/com", + srcs = ["src/main/resources/google/protobuf/java_features.proto"], + strip_import_prefix = "/java/core/src/main/resources", visibility = ["//pkg:__pkg__"], deps = ["//:descriptor_proto"], ) filegroup( name = "java_features_proto_srcs", - srcs = ["src/main/java/com/google/protobuf/java_features.proto"], + srcs = ["src/main/resources/google/protobuf/java_features.proto"], visibility = ["//pkg:__pkg__"], ) @@ -552,7 +552,7 @@ pkg_files( name = "dist_files", srcs = glob([ "src/main/java/com/google/protobuf/*.java", - "src/main/java/com/google/protobuf/*.proto", + "src/main/resources/google/protobuf/*.proto", "src/test/java/**/*.java", "src/test/proto/**/*.proto", ]) + [ diff --git a/java/core/generate-sources-build.xml b/java/core/generate-sources-build.xml index 4ffd4384dc416..7021aa8e2231d 100644 --- a/java/core/generate-sources-build.xml +++ b/java/core/generate-sources-build.xml @@ -5,7 +5,7 @@ <arg value="--java_out=${generated.sources.dir}"/> <arg value="--proto_path=${protobuf.source.dir}"/> <arg value="--proto_path=${protobuf.java_source.dir}"/> - <arg value="${protobuf.java_source.dir}/main/java/com/google/protobuf/java_features.proto"/> + <arg value="${protobuf.java_source.dir}/google/protobuf/java_features.proto"/> <arg value="${protobuf.source.dir}/google/protobuf/any.proto"/> <arg value="${protobuf.source.dir}/google/protobuf/api.proto"/> <arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/> diff --git a/java/core/pom.xml b/java/core/pom.xml index d52b903842b83..2d3977cbd33bb 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -62,7 +62,7 @@ <resource> <directory>${protobuf.java_source.dir}</directory> <includes> - <include>main/java/com/google/protobuf/java_features.proto</include> + <include>google/protobuf/java_features.proto</include> </includes> </resource> </resources> diff --git a/java/core/src/main/java/com/google/protobuf/java_features.proto b/java/core/src/main/resources/google/protobuf/java_features.proto similarity index 100% rename from java/core/src/main/java/com/google/protobuf/java_features.proto rename to java/core/src/main/resources/google/protobuf/java_features.proto diff --git a/java/pom.xml b/java/pom.xml index 440fd3c696b52..65d9c4bb1734c 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -33,7 +33,7 @@ <!-- These are relative to the submodules --> <protobuf.basedir>${project.basedir}/../..</protobuf.basedir> <protobuf.source.dir>${protobuf.basedir}/src</protobuf.source.dir> - <protobuf.java_source.dir>${protobuf.basedir}/java/core/src</protobuf.java_source.dir> + <protobuf.java_source.dir>${protobuf.basedir}/java/core/src/main/resources</protobuf.java_source.dir> <protoc>${protobuf.basedir}/protoc</protoc> <test.proto.dir>src/test/proto</test.proto.dir> <generated.sources.dir>${project.build.directory}/generated-sources</generated.sources.dir> diff --git a/src/google/protobuf/editions/golden/editions_transform_proto2.proto b/src/google/protobuf/editions/golden/editions_transform_proto2.proto index c8e9fb2b3eb6f..1a00ad8fe6ee1 100644 --- a/src/google/protobuf/editions/golden/editions_transform_proto2.proto +++ b/src/google/protobuf/editions/golden/editions_transform_proto2.proto @@ -14,7 +14,7 @@ edition = "2023"; package protobuf_editions_test; -import "third_party/java_src/protobuf/current/java/com/google/protobuf/java_features.proto"; +import "google/protobuf/java_features.proto"; import "google/protobuf/cpp_features.proto"; import "google/protobuf/editions/proto/editions_transform_proto3.proto"; From a2f5303916d00725cbd63ee92445b330f70d71a6 Mon Sep 17 00:00:00 2001 From: Sandy Zhang <sandyzhang@google.com> Date: Mon, 25 Mar 2024 20:42:41 -0400 Subject: [PATCH 2/2] Update cmake stalenes --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 3c97ff1980c56..33740dbd25b93 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -602,7 +602,7 @@ set(plugin_proto_files # @//java/core:java_features_proto set(java_features_proto_proto_srcs - ${protobuf_SOURCE_DIR}/java/core/src/main/java/com/google/protobuf/java_features.proto + ${protobuf_SOURCE_DIR}/java/core/src/main/resources/google/protobuf/java_features.proto ) # @//java/core:java_features_proto