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
Simplify test task state to make it CC-friendly #25983
Simplify test task state to make it CC-friendly #25983
Conversation
d8841a9
to
f1df59d
Compare
f1df59d
to
fe8bf21
Compare
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Outdated
Show resolved
Hide resolved
if (broadcaster == null) { | ||
broadcaster = getListenerManager().createAnonymousBroadcaster(listenerClass); | ||
for (Object listener: subscribedListeners) { | ||
if (listenerClass.isInstance(listener)) { |
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.
💅 A transaction log structure could get rid of these execution time decisions by recording the original configuration time decision.
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 had that at first, but with lack of support for lambdas, quite more code was needed (one inner class for each combination of event vs closure/listener).
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.
Hm, I see.
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Show resolved
Hide resolved
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Outdated
Show resolved
Hide resolved
70cc4b1
to
7777074
Compare
@bamboo I think we covered all the bits we discussed (minus adding guards for listener registration at execution time) |
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Outdated
Show resolved
Hide resolved
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Outdated
Show resolved
Hide resolved
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Show resolved
Hide resolved
subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java
Show resolved
Hide resolved
@@ -264,43 +264,52 @@ class TestTaskSpec extends AbstractProjectBuilderSpec { | |||
0 * closure._ | |||
} | |||
|
|||
def "adds listeners and removes after execution"() { | |||
def "removes listeners after execution"() { |
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 need to test AbstractTestTask#addTestOutputListener(TestOutputListener)
in the same way?
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.
Yeah, we could and maybe should.
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 couldn't figure how to do that. Couldn't get the event to be observed. Any tips?
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, I haven't tried anything like this, I just noticed the absence.
c701e3e
to
2183f54
Compare
…ndly ListenerBroadcast and friends are complex structures(with lots of lazy init'ing) and pose challenges for correctly storing/restoring their state to/from disk (as required by CC). This changeset simplifies the configuration-time state kept by AbstractTestTask so it only collects references to TestListener and TestOutputListener instances, without instantiating any ListenerBroadcasts. Issue: #25855 Co-authored-by: Rafael Chaves <rchaves@gradle.com>
Pre-tested commit build failed. Click here to see all build failures. |
ListenerBroadcast and friends are complex structures(with lots of lazy init'ing) and pose challenges for correctly storing/restoring their state to/from disk (as required by CC). This changeset simplifies the configuration-time state kept by AbstractTestTask so it only collects references to TestListener and TestOutputListener instances, without instantiating any ListenerBroadcasts. Issue: #25855
No synchronization required as listener addition/removal does not need to be thread-safe.
2183f54
to
6dc3fe3
Compare
@bot-gradle test and merge |
Your PR is queued. See the queue page for details. |
ListenerBroadcast and friends are complex structures(with lots of lazy init'ing) and pose challenges for correctly storing/restoring their state to/from disk (as required by CC).
This changeset simplifies the configuration-time state kept by AbstractTestTask so it only collects references to TestListener and TestOutputListener instances, without instantiating any ListenerBroadcasts.
Issue: #25855