-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt to jenkinsci/artifact-manager-s3-plugin#567 (#733)
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/org/jenkins/tools/test/hook/ArtifactManagerS3Hook.java
This file contains 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,28 @@ | ||
package org.jenkins.tools.test.hook; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import org.jenkins.tools.test.model.hook.BeforeExecutionContext; | ||
import org.jenkins.tools.test.model.hook.PluginCompatTesterHookBeforeExecution; | ||
import org.kohsuke.MetaInfServices; | ||
|
||
/** | ||
* Workaround for the fact that Artifact Manager on S3 has a dependency (jclouds) which uses a newer version of | ||
* Guice than Jenkins core. In this case, we intentionally violate upper bounds checks to maintain compatibility with | ||
* core. This works because the version of Guice shipped by core (6.0.0) supports both javax and jakarta imports, while | ||
* the version of Guice required by jclouds (7.0.0) supports only jakarta imports. In other words, the compatibility | ||
* matrix of the older version is a superset of the compatibility matrix of the newer version. | ||
*/ | ||
@MetaInfServices(PluginCompatTesterHookBeforeExecution.class) | ||
public class ArtifactManagerS3Hook extends PluginCompatTesterHookBeforeExecution { | ||
@Override | ||
public boolean check(@NonNull BeforeExecutionContext context) { | ||
return context.getPlugin().getPluginId().equals("artifact-manager-s3"); | ||
} | ||
|
||
@Override | ||
public void action(@NonNull BeforeExecutionContext context) { | ||
context.getUpperBoundsExcludes().add("com.google.inject.extensions:guice-assistedinject"); | ||
context.getUpperBoundsExcludes().add("com.google.inject:guice"); | ||
context.getUpperBoundsExcludes().add("com.google.inject:guice:classes"); | ||
} | ||
} |