Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

Yannic
Copy link
Contributor

@Yannic Yannic commented Dec 17, 2020

The information is already part of another field.

Cleanup after #12431 and #10939

@Yannic Yannic requested a review from lberki as a code owner December 17, 2020 21:25
@google-cla google-cla bot added the cla: yes label Dec 17, 2020
@jin jin added the team-Rules-Server Issues for serverside rules included with Bazel label Jan 15, 2021
@lberki lberki requested review from comius and removed request for lberki January 15, 2021 07:56
@comius comius assigned comius and unassigned lberki Jan 28, 2021
Copy link
Contributor

@comius comius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thanks!

Comment on lines 78 to 86
@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);
}
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 51 to 63
@Deprecated
public abstract NestedSet<Artifact> blacklistedProtos();

Copy link
Contributor

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.

Comment on lines +48 to +55
// 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()))
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Friendly ping.

Copy link
Contributor Author

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
Copy link
Contributor Author

@Yannic Yannic left a 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

Comment on lines +48 to +55
// 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()))
Copy link
Contributor Author

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.

Comment on lines 78 to 86
@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);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@bazel-io bazel-io closed this in 89e2f87 Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Rules-Server Issues for serverside rules included with Bazel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants