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
Add Problems to GradleEnterprisePluginEndOfBuildListener.BuildResult #28854
base: master
Are you sure you want to change the base?
Add Problems to GradleEnterprisePluginEndOfBuildListener.BuildResult #28854
Conversation
9b8d83e
to
b912930
Compare
9eccbde
to
cecb334
Compare
cecb334
to
cb8dd3f
Compare
9b3fad8
to
946ae11
Compare
946ae11
to
da1ba3f
Compare
07efcb0
to
be7a6b7
Compare
@@ -31,6 +34,8 @@ public interface GradleEnterprisePluginEndOfBuildListener { | |||
interface BuildResult { | |||
@Nullable | |||
Throwable getFailure(); | |||
|
|||
Collection<Problem> getProblems(); |
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'd still expect here that the Collection<Problem>
is for each individual failure. The getFailure()
method often returns a MultiCauseException
that needs to be converted to a list of individual failures by the Develocity plugin. Each of those failures needs to be associated to problems.
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.
Do you mean a Map of the Failures associated with the value returned by getFailure
to the Problems of these individual Failures?
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 think I want an actual new Failure
type here that wraps the problems/causes/stacktraces. Like I said, I can do that as long as I can query something.
Maybe having a method getProblemsFor(Throwable failure)
would be better for now and I can take it from there.
@@ -57,14 +63,16 @@ public DefaultGradleEnterprisePluginAdapter( | |||
DefaultGradleEnterprisePluginRequiredServices requiredServices, | |||
GradleEnterprisePluginBuildState buildState, | |||
DefaultGradleEnterprisePluginServiceRef pluginServiceRef, | |||
BuildOperationNotificationListenerRegistrar buildOperationNotificationListenerRegistrar | |||
BuildOperationNotificationListenerRegistrar buildOperationNotificationListenerRegistrar, | |||
Multimap<Throwable, Problem> problemsMapping |
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.
❌ We should provide our own service here, instead of directly exposing Multimap
.
while(buildFailure != null) { | ||
Collection<Problem> problems = problemsMapping.get(buildFailure); | ||
builder.addAll(problems); | ||
buildFailure = buildFailure.getCause(); |
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 don't think this works for a MultiCauseException
, where you'd have multiple causes.
@@ -95,14 +103,28 @@ public void buildFinished(@Nullable Throwable buildFailure) { | |||
public Throwable getFailure() { | |||
return buildFailure; | |||
} | |||
|
|||
@Override | |||
public Collection<Problem> getProblems() { |
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.
🤔 It would be very good to be able to obtain the problems for each cause of the failure individually. That is something I can build on top of the infrastructure you provide here.
@@ -16,44 +16,55 @@ | |||
|
|||
package org.gradle.internal.enterprise | |||
|
|||
|
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.
💅 Extra newline.
.../ide/problems-api/src/main/java/org/gradle/api/problems/internal/DefaultProblemReporter.java
Outdated
Show resolved
Hide resolved
@@ -57,30 +65,25 @@ public RuntimeException throwing(Action<ProblemSpec> spec) { | |||
|
|||
public RuntimeException throwError(RuntimeException exception, Problem problem) { | |||
report(problem); | |||
problems.put(exception, problem); |
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 we only associate the exception to the problem when we throw the exception via the Problem API? I think every time we report a problem that has an exception we should associate it, right?
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.
makes sense, yes.
19d8b1b
to
5b3f540
Compare
5b3f540
to
ca782b9
Compare
…risePluginEndOfBuildListener.BuildResult
ca782b9
to
e077238
Compare
@bot-gradle PRF |
Sorry I don't understand what you said.
|
@bot-gradle test PRF |
I've triggered the following builds for you. Click here to see all build failures. |
Reviewing cheatsheet
Before merging the PR, comments starting with