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

Make workflow-support compatible with Guava 21.0 and newer #114

Merged
merged 11 commits into from
Mar 4, 2021

Conversation

timja
Copy link
Member

@timja timja commented Jan 16, 2021

See jenkinsci/jenkins#5059.

workflow-support previously used MoreExecutors.sameThreadExecutor from Guava, which was removed in version 21.0 in favor of MoreExecutors.newDirectExecutorService. This PR uses reflection to first try to call MoreExecutors.newDirectExecutorService but then call MoreExecutors.sameThreadExecutor if the first method is not available to support both older and newer versions of Guava.

@timja
Copy link
Member Author

timja commented Jan 16, 2021

seriously -.-, old pinned version in Jenkinsfile...

@timja timja mentioned this pull request Jan 17, 2021
pom.xml Outdated
@@ -64,11 +64,12 @@
<properties>
<revision>3.8</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.222.4</jenkins.version>
<jenkins.version>2.273-rc30689.09147672b85b</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

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

Can you please link to whatever Jenkins core PR produced this incremental so reviewers have more context about the proposed change? Thanks!

pom.xml Outdated Show resolved Hide resolved
@@ -324,7 +324,7 @@ public void run() {
public static <V> ListenableFuture<List<V>> allAsList(
ListenableFuture<? extends V>... futures) {
return new ListFuture<V>(ImmutableList.copyOf(futures), true,
MoreExecutors.sameThreadExecutor());
MoreExecutors.newDirectExecutorService());
Copy link
Member

Choose a reason for hiding this comment

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

Since this is since Guava 18, maybe we could use reflection to try newDirectExecutorService then fall back to sameThreadExecutor, then revert the core bump?

Or copy the impl into this plugin, keeping the Apache license header.

Copy link
Member Author

Choose a reason for hiding this comment

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

nice idea, when I was working on it (and plan to get back to it, although others are welcome to take it up) I was trying to get a green bom PCT build and then look at what's required and see where changes like your suggestion could be applied.

Copy link
Member

Choose a reason for hiding this comment

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

I have this change ready to push. Is it ok if I push to your branch @timja?

Copy link
Member Author

Choose a reason for hiding this comment

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

absolutely go for it

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Errr, I don't have push permission here, so I've filed a PR to your forked branch: timja#1

Copy link
Member

Choose a reason for hiding this comment

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

also see jenkinsci/workflow-api-plugin#135 and jenkinsci/bom#423

I'll have a look. Meanwhile, isn't this PR mergeable as is?

Copy link
Member Author

Choose a reason for hiding this comment

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

looks good to me

pom.xml Outdated Show resolved Hide resolved
@timja timja marked this pull request as ready for review March 3, 2021 16:45
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
@dwnusbaum dwnusbaum changed the title Upgrade guava Make workflow-support compatible with Guava 21.0 and newer Mar 3, 2021
@dwnusbaum dwnusbaum requested a review from car-roll March 3, 2021 17:36
@dwnusbaum
Copy link
Member

dwnusbaum commented Mar 3, 2021

I updated the PR title and description to reflect the proposed change.

@car-roll car-roll merged commit af9ed05 into jenkinsci:master Mar 4, 2021
@timja timja deleted the test-new-guava branch March 4, 2021 07:24
@jglick
Copy link
Member

jglick commented Mar 4, 2021

@car-roll this will need a release too. (Or https://github.com/jenkinsci/incrementals-tools#automatic-deployment if you are sick of my bugging you about stuff like this 😁.)

@car-roll
Copy link
Contributor

car-roll commented Mar 4, 2021

if you are sick of my bugging you about stuff like this

Not yet! 😁 But I should probably look into that stuff still...
Will release later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants