Skip to content

Commit 6059cb7

Browse files
authored
Cherry-pick notices change for 30.x
Cherry-pick notices change for 30.x
2 parents 9d9ad22 + 6abaf77 commit 6059cb7

7 files changed

+279
-15
lines changed

MODULE.bazel

+19-9
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,36 @@ module(
1212
# Bzlmod follows MVS:
1313
# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution
1414
# Thus the highest version in their module graph is resolved.
15-
bazel_dep(name = "abseil-cpp", version = "20250127.0")
16-
bazel_dep(name = "bazel_skylib", version = "1.7.1")
17-
bazel_dep(name = "jsoncpp", version = "1.9.6")
15+
16+
# These dependencies must be declared before the other rules dependencies.
1817
bazel_dep(name = "rules_apple", version = "3.13.0", repo_name = "build_bazel_rules_apple")
1918
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
19+
20+
#ifndef PROTO2_OPENSOURCE
21+
# LINT.IfChange
22+
#endif // PROTO2_OPENSOURCE
23+
# protoc dependencies
24+
bazel_dep(name = "abseil-cpp", version = "20250127.0")
2025
bazel_dep(name = "rules_cc", version = "0.0.17")
26+
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
27+
#ifndef PROTO2_OPENSOURCE
28+
# LINT.ThenChange(//depot/google3/third_party/protobuf/compiler/notices.h)
29+
#endif // PROTO2_OPENSOURCE
30+
31+
# other dependencies
32+
bazel_dep(name = "bazel_features", version = "1.23.0", repo_name = "proto_bazel_features")
33+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
34+
bazel_dep(name = "jsoncpp", version = "1.9.6")
2135
bazel_dep(name = "rules_fuzzing", version = "0.5.2")
2236
bazel_dep(name = "rules_java", version = "8.6.1")
2337
bazel_dep(name = "rules_jvm_external", version = "6.3")
2438
bazel_dep(name = "rules_kotlin", version = "1.9.6")
2539
bazel_dep(name = "rules_license", version = "1.0.0")
2640
bazel_dep(name = "rules_pkg", version = "1.0.1")
2741
bazel_dep(name = "rules_python", version = "1.0.0")
42+
bazel_dep(name = "rules_rust", version = "0.51.0")
43+
bazel_dep(name = "rules_shell", version = "0.2.0")
2844
bazel_dep(name = "platforms", version = "0.0.10")
29-
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
30-
bazel_dep(name = "bazel_features", version = "1.23.0", repo_name = "proto_bazel_features")
31-
bazel_dep(
32-
name = "rules_shell",
33-
version = "0.2.0",
34-
)
3545

3646
# Proto toolchains
3747
register_toolchains("//bazel/private/toolchains:all")

cmake/dependencies.cmake

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,24 @@ if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16)
1010
include_guard()
1111
endif()
1212

13-
set(abseil-cpp-version "20250127.0")
14-
set(bazel_skylib-version "1.7.1")
15-
set(jsoncpp-version "1.9.6")
1613
set(rules_apple-version "3.13.0")
1714
set(apple_support-version "1.15.1")
15+
set(abseil-cpp-version "20250127.0")
1816
set(rules_cc-version "0.0.17")
17+
set(zlib-version "1.3.1.bcr.5")
18+
set(bazel_features-version "1.23.0")
19+
set(bazel_skylib-version "1.7.1")
20+
set(jsoncpp-version "1.9.6")
1921
set(rules_fuzzing-version "0.5.2")
2022
set(rules_java-version "8.6.1")
2123
set(rules_jvm_external-version "6.3")
2224
set(rules_kotlin-version "1.9.6")
2325
set(rules_license-version "1.0.0")
2426
set(rules_pkg-version "1.0.1")
2527
set(rules_python-version "1.0.0")
26-
set(platforms-version "0.0.10")
27-
set(zlib-version "1.3.1.bcr.5")
28-
set(bazel_features-version "1.23.0")
28+
set(rules_rust-version "0.51.0")
2929
set(rules_shell-version "0.2.0")
30+
set(platforms-version "0.0.10")
3031
set(googletest-version "1.14.0")
3132
set(rules_buf-version "0.3.0")
3233
set(rules_testing-version "0.6.0")

cmake/installed_include_golden.txt

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ google/protobuf/compiler/java/java_features.pb.h
2525
google/protobuf/compiler/java/name_resolver.h
2626
google/protobuf/compiler/java/names.h
2727
google/protobuf/compiler/java/options.h
28+
google/protobuf/compiler/notices.h
2829
google/protobuf/compiler/objectivec/line_consumer.h
2930
google/protobuf/compiler/objectivec/names.h
3031
google/protobuf/compiler/objectivec/nsobject_methods.h

src/file_lists.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ set(libprotoc_public_hdrs
328328
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.h
329329
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.h
330330
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/options.h
331+
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/notices.h
331332
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/line_consumer.h
332333
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/names.h
333334
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/nsobject_methods.h
@@ -562,6 +563,7 @@ set(libprotoc_hdrs
562563
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/file.h
563564
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/generator.h
564565
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/message.h
566+
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/notices.h
565567
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/enum.h
566568
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/enum_field.h
567569
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/extension.h

src/google/protobuf/compiler/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ cc_library(
177177
],
178178
hdrs = [
179179
"command_line_interface.h",
180+
"notices.h",
180181
"subprocess.h",
181182
"zip_writer.h",
182183
],

src/google/protobuf/compiler/command_line_interface.cc

+7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#endif
9393

9494
#include "google/protobuf/stubs/platform_macros.h"
95+
#include "google/protobuf/compiler/notices.h"
9596

9697
// Must be included last.
9798
#include "google/protobuf/port_def.inc"
@@ -2000,6 +2001,7 @@ bool CommandLineInterface::ParseArgument(const char* arg, std::string* name,
20002001
*name == "--include_imports" || *name == "--include_source_info" ||
20012002
*name == "--retain_options" || *name == "--version" ||
20022003
*name == "--decode_raw" ||
2004+
*name == "--notices" ||
20032005
*name == "--experimental_editions" ||
20042006
*name == "--print_free_field_numbers" ||
20052007
*name == "--experimental_allow_proto3_optional" ||
@@ -2327,6 +2329,9 @@ CommandLineInterface::InterpretArgument(const std::string& name,
23272329
#else
23282330
::setenv(io::Printer::kProtocCodegenTrace.data(), "yes", 0);
23292331
#endif
2332+
} else if (name == "--notices") {
2333+
std::cout << notices_text << std::endl;
2334+
return PARSE_ARGUMENT_DONE_AND_EXIT;
23302335
} else if (name == "--experimental_editions") {
23312336
// If you're reading this, you're probably wondering what
23322337
// --experimental_editions is for and thinking of turning it on. This is an
@@ -2502,6 +2507,8 @@ Parse PROTO_FILES and generate output based on the options given:
25022507
--enable_codegen_trace Enables tracing which parts of protoc are
25032508
responsible for what codegen output. Not supported
25042509
by all backends or on all platforms.)";
2510+
std::cout << R"(
2511+
--notices Show notice file and exit.)";
25052512
if (!plugin_prefix_.empty()) {
25062513
std::cout << R"(
25072514
--plugin=EXECUTABLE Specifies a plugin executable to use.
+242
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
#ifndef GOOGLE_PROTOBUF_COMPILER_NOTICES_H__
2+
#define GOOGLE_PROTOBUF_COMPILER_NOTICES_H__
3+
4+
const char* notices_text = R"(Protoc uses the following open source libraries:
5+
6+
Abseil
7+
Apache 2.0
8+
Apache License
9+
Version 2.0, January 2004
10+
https://www.apache.org/licenses/
11+
12+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13+
14+
1. Definitions.
15+
16+
"License" shall mean the terms and conditions for use, reproduction,
17+
and distribution as defined by Sections 1 through 9 of this document.
18+
19+
"Licensor" shall mean the copyright owner or entity authorized by
20+
the copyright owner that is granting the License.
21+
22+
"Legal Entity" shall mean the union of the acting entity and all
23+
other entities that control, are controlled by, or are under common
24+
control with that entity. For the purposes of this definition,
25+
"control" means (i) the power, direct or indirect, to cause the
26+
direction or management of such entity, whether by contract or
27+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
28+
outstanding shares, or (iii) beneficial ownership of such entity.
29+
30+
"You" (or "Your") shall mean an individual or Legal Entity
31+
exercising permissions granted by this License.
32+
33+
"Source" form shall mean the preferred form for making modifications,
34+
including but not limited to software source code, documentation
35+
source, and configuration files.
36+
37+
"Object" form shall mean any form resulting from mechanical
38+
transformation or translation of a Source form, including but
39+
not limited to compiled object code, generated documentation,
40+
and conversions to other media types.
41+
42+
"Work" shall mean the work of authorship, whether in Source or
43+
Object form, made available under the License, as indicated by a
44+
copyright notice that is included in or attached to the work
45+
(an example is provided in the Appendix below).
46+
47+
"Derivative Works" shall mean any work, whether in Source or Object
48+
form, that is based on (or derived from) the Work and for which the
49+
editorial revisions, annotations, elaborations, or other modifications
50+
represent, as a whole, an original work of authorship. For the purposes
51+
of this License, Derivative Works shall not include works that remain
52+
separable from, or merely link (or bind by name) to the interfaces of,
53+
the Work and Derivative Works thereof.
54+
55+
"Contribution" shall mean any work of authorship, including
56+
the original version of the Work and any modifications or additions
57+
to that Work or Derivative Works thereof, that is intentionally
58+
submitted to Licensor for inclusion in the Work by the copyright owner
59+
or by an individual or Legal Entity authorized to submit on behalf of
60+
the copyright owner. For the purposes of this definition, "submitted"
61+
means any form of electronic, verbal, or written communication sent
62+
to the Licensor or its representatives, including but not limited to
63+
communication on electronic mailing lists, source code control systems,
64+
and issue tracking systems that are managed by, or on behalf of, the
65+
Licensor for the purpose of discussing and improving the Work, but
66+
excluding communication that is conspicuously marked or otherwise
67+
designated in writing by the copyright owner as "Not a Contribution."
68+
69+
"Contributor" shall mean Licensor and any individual or Legal Entity
70+
on behalf of whom a Contribution has been received by Licensor and
71+
subsequently incorporated within the Work.
72+
73+
2. Grant of Copyright License. Subject to the terms and conditions of
74+
this License, each Contributor hereby grants to You a perpetual,
75+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76+
copyright license to reproduce, prepare Derivative Works of,
77+
publicly display, publicly perform, sublicense, and distribute the
78+
Work and such Derivative Works in Source or Object form.
79+
80+
3. Grant of Patent License. Subject to the terms and conditions of
81+
this License, each Contributor hereby grants to You a perpetual,
82+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83+
(except as stated in this section) patent license to make, have made,
84+
use, offer to sell, sell, import, and otherwise transfer the Work,
85+
where such license applies only to those patent claims licensable
86+
by such Contributor that are necessarily infringed by their
87+
Contribution(s) alone or by combination of their Contribution(s)
88+
with the Work to which such Contribution(s) was submitted. If You
89+
institute patent litigation against any entity (including a
90+
cross-claim or counterclaim in a lawsuit) alleging that the Work
91+
or a Contribution incorporated within the Work constitutes direct
92+
or contributory patent infringement, then any patent licenses
93+
granted to You under this License for that Work shall terminate
94+
as of the date such litigation is filed.
95+
96+
4. Redistribution. You may reproduce and distribute copies of the
97+
Work or Derivative Works thereof in any medium, with or without
98+
modifications, and in Source or Object form, provided that You
99+
meet the following conditions:
100+
101+
(a) You must give any other recipients of the Work or
102+
Derivative Works a copy of this License; and
103+
104+
(b) You must cause any modified files to carry prominent notices
105+
stating that You changed the files; and
106+
107+
(c) You must retain, in the Source form of any Derivative Works
108+
that You distribute, all copyright, patent, trademark, and
109+
attribution notices from the Source form of the Work,
110+
excluding those notices that do not pertain to any part of
111+
the Derivative Works; and
112+
113+
(d) If the Work includes a "NOTICE" text file as part of its
114+
distribution, then any Derivative Works that You distribute must
115+
include a readable copy of the attribution notices contained
116+
within such NOTICE file, excluding those notices that do not
117+
pertain to any part of the Derivative Works, in at least one
118+
of the following places: within a NOTICE text file distributed
119+
as part of the Derivative Works; within the Source form or
120+
documentation, if provided along with the Derivative Works; or,
121+
within a display generated by the Derivative Works, if and
122+
wherever such third-party notices normally appear. The contents
123+
of the NOTICE file are for informational purposes only and
124+
do not modify the License. You may add Your own attribution
125+
notices within Derivative Works that You distribute, alongside
126+
or as an addendum to the NOTICE text from the Work, provided
127+
that such additional attribution notices cannot be construed
128+
as modifying the License.
129+
130+
You may add Your own copyright statement to Your modifications and
131+
may provide additional or different license terms and conditions
132+
for use, reproduction, or distribution of Your modifications, or
133+
for any such Derivative Works as a whole, provided Your use,
134+
reproduction, and distribution of the Work otherwise complies with
135+
the conditions stated in this License.
136+
137+
5. Submission of Contributions. Unless You explicitly state otherwise,
138+
any Contribution intentionally submitted for inclusion in the Work
139+
by You to the Licensor shall be under the terms and conditions of
140+
this License, without any additional terms or conditions.
141+
Notwithstanding the above, nothing herein shall supersede or modify
142+
the terms of any separate license agreement you may have executed
143+
with Licensor regarding such Contributions.
144+
145+
6. Trademarks. This License does not grant permission to use the trade
146+
names, trademarks, service marks, or product names of the Licensor,
147+
except as required for reasonable and customary use in describing the
148+
origin of the Work and reproducing the content of the NOTICE file.
149+
150+
7. Disclaimer of Warranty. Unless required by applicable law or
151+
agreed to in writing, Licensor provides the Work (and each
152+
Contributor provides its Contributions) on an "AS IS" BASIS,
153+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154+
implied, including, without limitation, any warranties or conditions
155+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156+
PARTICULAR PURPOSE. You are solely responsible for determining the
157+
appropriateness of using or redistributing the Work and assume any
158+
risks associated with Your exercise of permissions under this License.
159+
160+
8. Limitation of Liability. In no event and under no legal theory,
161+
whether in tort (including negligence), contract, or otherwise,
162+
unless required by applicable law (such as deliberate and grossly
163+
negligent acts) or agreed to in writing, shall any Contributor be
164+
liable to You for damages, including any direct, indirect, special,
165+
incidental, or consequential damages of any character arising as a
166+
result of this License or out of the use or inability to use the
167+
Work (including but not limited to damages for loss of goodwill,
168+
work stoppage, computer failure or malfunction, or any and all
169+
other commercial damages or losses), even if such Contributor
170+
has been advised of the possibility of such damages.
171+
172+
9. Accepting Warranty or Additional Liability. While redistributing
173+
the Work or Derivative Works thereof, You may choose to offer,
174+
and charge a fee for, acceptance of support, warranty, indemnity,
175+
or other liability obligations and/or rights consistent with this
176+
License. However, in accepting such obligations, You may act only
177+
on Your own behalf and on Your sole responsibility, not on behalf
178+
of any other Contributor, and only if You agree to indemnify,
179+
defend, and hold each Contributor harmless for any liability
180+
incurred by, or claims asserted against, such Contributor by reason
181+
of your accepting any such warranty or additional liability.
182+
=============================================================================
183+
utf8_range
184+
MIT License
185+
186+
Copyright (c) 2019 Yibo Cai
187+
Copyright 2022 Google LLC
188+
189+
Permission is hereby granted, free of charge, to any person obtaining a copy
190+
of this software and associated documentation files (the "Software"), to deal
191+
in the Software without restriction, including without limitation the rights
192+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
193+
copies of the Software, and to permit persons to whom the Software is
194+
furnished to do so, subject to the following conditions:
195+
196+
The above copyright notice and this permission notice shall be included in all
197+
copies or substantial portions of the Software.
198+
199+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
200+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
201+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
202+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
203+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
204+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
205+
SOFTWARE.
206+
=============================================================================
207+
zlib
208+
209+
Copyright notice:
210+
211+
(C) 1995-2024 Jean-loup Gailly and Mark Adler
212+
213+
This software is provided 'as-is', without any express or implied
214+
warranty. In no event will the authors be held liable for any damages
215+
arising from the use of this software.
216+
217+
Permission is granted to anyone to use this software for any purpose,
218+
including commercial applications, and to alter it and redistribute it
219+
freely, subject to the following restrictions:
220+
221+
1. The origin of this software must not be misrepresented; you must not
222+
claim that you wrote the original software. If you use this software
223+
in a product, an acknowledgment in the product documentation would be
224+
appreciated but is not required.
225+
2. Altered source versions must be plainly marked as such, and must not be
226+
misrepresented as being the original software.
227+
3. This notice may not be removed or altered from any source distribution.
228+
229+
Jean-loup Gailly Mark Adler
230+
jloup@gzip.org madler@alumni.caltech.edu
231+
=============================================================================
232+
rules_cc
233+
234+
Copyright 2024 The Bazel Authors.
235+
Apache License 2.0
236+
=============================================================================
237+
Bazel
238+
239+
Copyright 2014 The Bazel Authors.
240+
Apache License 2.0)";
241+
242+
#endif // GOOGLE_PROTOBUF_COMPILER_NOTICES_H__

0 commit comments

Comments
 (0)