-
Notifications
You must be signed in to change notification settings - Fork 169
add option to record transferred artifacts #1875
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
907cde8
initial commit
smurf667 a7eb849
Iterate on OtelTransferListener
cyrille-leclerc a0fb583
Merge pull request #1 from cyrille-leclerc/1874-transfer-listener
smurf667 0aab248
cosmetics
smurf667 88142d2
cosmetics
smurf667 25951df
fix variable naming
smurf667 41caafc
Iterate on OtelTransferListener
cyrille-leclerc 2c14c29
Merge pull request #2 from cyrille-leclerc/1874-transfer-listener
smurf667 2b43900
drop leftover TODOs
smurf667 cbbc2d7
spotlessApply
cyrille-leclerc af614d3
Merge pull request #3 from cyrille-leclerc/1874-transfer-listener
smurf667 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
maven-extension/src/main/java/io/opentelemetry/maven/ChainedTransferListener.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.maven; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
| import org.eclipse.aether.transfer.TransferCancelledException; | ||
| import org.eclipse.aether.transfer.TransferEvent; | ||
| import org.eclipse.aether.transfer.TransferListener; | ||
|
|
||
| /** | ||
| * Util class to chain multiple {@link TransferListener} as Maven APIs don't offer this capability. | ||
| */ | ||
| final class ChainedTransferListener implements TransferListener { | ||
|
|
||
| private final List<TransferListener> listeners; | ||
|
|
||
| /** | ||
| * @param listeners {@code null} values are filtered | ||
| */ | ||
| ChainedTransferListener(TransferListener... listeners) { | ||
| this.listeners = Arrays.stream(listeners).filter(e -> e != null).collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @Override | ||
| public void transferInitiated(TransferEvent event) throws TransferCancelledException { | ||
| for (TransferListener listener : this.listeners) { | ||
| listener.transferInitiated(event); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void transferStarted(TransferEvent event) throws TransferCancelledException { | ||
| for (TransferListener listener : this.listeners) { | ||
| listener.transferStarted(event); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void transferProgressed(TransferEvent event) throws TransferCancelledException { | ||
| for (TransferListener listener : this.listeners) { | ||
| listener.transferProgressed(event); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void transferCorrupted(TransferEvent event) throws TransferCancelledException { | ||
| for (TransferListener listener : this.listeners) { | ||
| listener.transferCorrupted(event); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void transferSucceeded(TransferEvent event) { | ||
| for (TransferListener listener : this.listeners) { | ||
| listener.transferSucceeded(event); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void transferFailed(TransferEvent event) { | ||
| for (TransferListener listener : this.listeners) { | ||
| listener.transferFailed(event); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 did we change something here? I didn't expect this PR to touch the execution listener. Did I miss something? I'll look at the code.
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 just moved this into a smaller method for symmetry reasons (
register<XXX>Listener()) - I left a TODO, because I am not sure if some quirky Maven behavior is responsible for the need to register the exection listener inafterProjectsRead()vsafterSessionStart()- normally, I'd expect both listeners to be registered at the same place, but it appears actual Maven behavior necessitates the current code.