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

Ignore OS as an input to GenerateProtoTask #2

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,26 @@ public abstract class GenerateProtoTask extends DefaultTask {
@InputFiles
@PathSensitive(PathSensitivity.NONE)
ConfigurableFileCollection getAlternativePaths() {
return objectFactory.fileCollection().from(getLocatorToAlternativePathsMapping().get().values())
objectFactory.fileCollection().from(locatorToAlternativePathsMapping.map {
if (protocArtifactGav.map { !it.endsWith("-SNAPSHOT") }.getOrElse(false)) {
it.findAll { it.key != protocLocator.get().name }

Choose a reason for hiding this comment

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

Could you add a comment explaining what the logic is and why it is that way? I think this would help future readers or when trying to debug things here.

It would also be good here to name parameters since I think we have nested it and it becomes hard to follow which one is which.

} else {
it
}}.get().values())
}

@Input
@Optional
Provider<String> getProtocArtifactGav() {
// Avoiding Provider#map to support Gradle < 6.2 since artifact can be null
// See https://github.com/gradle/gradle/issues/11979
providerFactory.provider {
def protocArtifact = protocLocator.get().artifact
if (protocArtifact) {
def (group, artifact, version) = ToolsLocator.artifactParts(protocArtifact)
"$group:$artifact:$version"
}
} as Provider<String>
}

@Internal("Input captured by getAlternativePaths()")
Expand Down