Skip to content

Commit 45b1297

Browse files
thomasvlcopybara-github
authored andcommitted
[ObjC] Remove generate_minimal_imports generation option warning
Since protobuf now has `import option` the original idea around this is reduced; but more importantly, using the option can run into problems if a build system wants to do layering checks on the generated code. So... - Document the problem - Remove the warning It may make sense to flip the default on this option back in the future and even deprecated/eventually remove it. The other choice would be to figure out how to make the generation work with the transitive `import public` problem. PiperOrigin-RevId: 820681829
1 parent 566c800 commit 45b1297

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/google/protobuf/compiler/objectivec/file.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,17 @@ void FileGenerator::DetermineNeededDeps(
836836
PublicDepsHandling public_deps_handling) const {
837837
// This logic captures the deps that are needed for types thus removing the
838838
// ones that are only deps because they provide the definitions for custom
839-
// options. If protoc gets something like "import options" then this logic can
840-
// go away as the non "import options" deps would be the ones needed.
839+
// options.
840+
//
841+
// However, this as the side effect of if something was needed and it was
842+
// coming from a `import public` *within* an `import`, then a `#import` will
843+
// be generated for that otherwise transitive import. If some build system
844+
// wants to do some sort of strict layering checks on the generated code, then
845+
// it will fail those checks.
846+
//
847+
// Since the original intent of this "mode" was to help prune out headers for
848+
// custom options, and protobuf now does support `import option`, it likely
849+
// makes sense to remove this in the future instead.
841850

842851
if (public_deps_handling == PublicDepsHandling::kForceInclude) {
843852
for (int i = 0; i < file_->public_dependency_count(); i++) {

src/google/protobuf/compiler/objectivec/generator.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,6 @@ bool ObjectiveCGenerator::GenerateAll(
344344
<< std::endl;
345345
std::cerr.flush();
346346
}
347-
if (!generation_options.generate_minimal_imports &&
348-
!absl::StrContains(options_warnings_suppressions,
349-
"generate_minimal_imports")) {
350-
std::cerr << "WARNING: generate_minimal_imports is disabled, this is "
351-
"deprecated and will be removed in the future. If you have a "
352-
"need for disabling it please file an issue at "
353-
"https://github.com/protocolbuffers/protobuf/issues with "
354-
"your use case."
355-
<< std::endl;
356-
std::cerr.flush();
357-
}
358347
if (!generation_options.strip_custom_options &&
359348
!absl::StrContains(options_warnings_suppressions,
360349
"strip_custom_options")) {

0 commit comments

Comments
 (0)