Prune unused vendored protobuf sources#2066
Merged
thomasvl merged 4 commits intoMay 22, 2026
Merged
Conversation
FranzBusch
approved these changes
May 21, 2026
Collaborator
|
@Qabbout - Can you also delete |
…rotobuf/compiler/
Contributor
Author
|
Done ✅ @thomasvl |
Collaborator
|
Shoot. Forgot, since we're removing Sources/protobuf/protobuf/src/google/protobuf/util/python/testdata/test_messages.proto, we also need to remove Reference/upstream/google/protobuf/util/python. |
Collaborator
|
@Qabbout I think that will be the last thing needed. You should be able to do a |
Contributor
Author
|
Thanks for the tip @thomasvl we should be good to go. |
Collaborator
|
Thanks again for the patience, merging now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR reduces the amount of vendored upstream protobuf/abseil source that SwiftPM clients need to check out when depending on SwiftProtobuf.
It does this by pruning upstream files that are not used by SwiftProtobuf's package products:
protocbuilt-in language generator implementations for C++, C#, Java, Kotlin, Objective-C, PHP, Python, Ruby, and RustIt also updates
scripts/UpdateProtobufSubtrees.pyso future vendored protobuf/abseil refreshes continue to prune the same unused files instead of reintroducing them.Motivation
Xcode/SwiftPM package resolution can spend a noticeable amount of time checking out SwiftProtobuf when it appears as a transitive dependency in iOS projects. A meaningful part of the package payload comes from vendored upstream protobuf/abseil files.
SwiftProtobuf's
protocexecutable target usesSources/protobuf/main.cc, not upstream's fullcompiler/main.cc. That entry point enables externalprotoc-*plugins and does not register upstream's built-in language generators. The pruned generator trees therefore are not compiled or exposed by this package target.The Swift package also has its own test/reference/fuzz/compile-test inputs under
Tests/,Protos/,Reference/,FuzzTesting/, andCompileTests/; the removed upstream C++ test fixtures are not part of the SwiftPM build/test graph.Local impact
Measured locally after this change:
Sources/protobufsize dropped from about34Mto28MSources/protobufdropped from2733to178757.2Mto53.7MThis is intentionally a conservative reduction. It does not change public Swift APIs, package products, target names, or plugin behavior.
Validation
Ran locally on macOS with Apple Swift
6.3.1:swift testresult:Executed 958 tests, with 0 failures (0 unexpected)Notes and limitations
This reduces checkout payload for future commits/releases that include the change. It cannot change the checkout behavior of already-published tags.
A larger improvement would be to split runtime-only consumers from generator/tooling sources so iOS apps that only need the
SwiftProtobufruntime do not need to fetchprotocimplementation sources at all. That would be a broader package-structure change; this PR keeps the current package structure and only removes files that are unused by the existing SwiftPM products.