-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove {direct,transitive}OriginalSources field from ProtoInfo #12727
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Thanks!
@Deprecated | ||
public static ProtoLangToolchainProvider create( | ||
String commandLine, | ||
FilesToRunProvider pluginExecutable, | ||
TransitiveInfoCollection runtime, | ||
NestedSet<Artifact> blacklistedProtos) { | ||
return new AutoValue_ProtoLangToolchainProvider( | ||
commandLine, pluginExecutable, runtime, blacklistedProtos); | ||
commandLine, pluginExecutable, runtime, ImmutableList.of(), blacklistedProtos); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked internally and the method may be safely deleted. And then I believe you can use NestedSet for providedProtoSources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@Deprecated | ||
public abstract NestedSet<Artifact> blacklistedProtos(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep. Can't be safely removed.
// We intentionally flatten the NestedSet here. | ||
// | ||
// `providedProtoSources` are read during analysis, so flattening the set here once | ||
// avoid flattening it in every `<lang>_proto_aspect` applied to `proto_library` | ||
// targets. While this has the potential to use more memory than using a NestedSet, | ||
// there are only a few `proto_lang_toolchain` targets in every build, so the impact | ||
// on memory consumption should be neglectable. | ||
providedProtoSources.build().toList())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to flatten the NestedSet? If I understand this correctly, so that you can use overloaded ProtoLangToolchainProvider.create? I'd prefer if you remove the old implementation of create and just use NestedSet. I checked that there are no dependencies internally. If you're worried about other forks of Bazel, perhaps you could change the create method name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Friendly ping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this not for overloading ProtoLangToolchainProvider#create()
. Today, every <lang>_proto_library
has to flatten the set to figure out which of its srcs
is in blacklistedProtos()
, which does have performance overhead. We can avoid that by flattening it here once and propagate the excluded protos as list instead. We trade some (finite) memory for performance.
The information is already part of another field. Cleanup after bazelbuild#12431 and bazelbuild#10939
0739386
to
5a3dc64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the super long delay! PTAL
// We intentionally flatten the NestedSet here. | ||
// | ||
// `providedProtoSources` are read during analysis, so flattening the set here once | ||
// avoid flattening it in every `<lang>_proto_aspect` applied to `proto_library` | ||
// targets. While this has the potential to use more memory than using a NestedSet, | ||
// there are only a few `proto_lang_toolchain` targets in every build, so the impact | ||
// on memory consumption should be neglectable. | ||
providedProtoSources.build().toList())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this not for overloading ProtoLangToolchainProvider#create()
. Today, every <lang>_proto_library
has to flatten the set to figure out which of its srcs
is in blacklistedProtos()
, which does have performance overhead. We can avoid that by flattening it here once and propagate the excluded protos as list instead. We trade some (finite) memory for performance.
@Deprecated | ||
public static ProtoLangToolchainProvider create( | ||
String commandLine, | ||
FilesToRunProvider pluginExecutable, | ||
TransitiveInfoCollection runtime, | ||
NestedSet<Artifact> blacklistedProtos) { | ||
return new AutoValue_ProtoLangToolchainProvider( | ||
commandLine, pluginExecutable, runtime, blacklistedProtos); | ||
commandLine, pluginExecutable, runtime, ImmutableList.of(), blacklistedProtos); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
The information is already part of another field.
Cleanup after #12431 and #10939