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

Migrate from deprecated org.eclipse.aether.impl.guice.AetherModule to Sisu #1733

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

cstamas
Copy link
Contributor

@cstamas cstamas commented Sep 24, 2024

Migrate to Sisu and drop use of deprecated AetherModule (is removed in Resolver 2.x).

This PR uses "fully fledged" Sisu to create RepositorySystem instance, and will discover (using sisu index) dynamically any JSR330 component that is present on classpath at the moment AetherModule is being constructed.

Also, Guice and Sisu are changed (by exclusion from transitive dep and explicit addition as direct dependency) to "no asm" versions (these have no shaded in ASM), and since ASM was already on path (was 9.2) updated to latest 9.7. Now Guice and Sisu and that something (that pulled ASM in orginally) all use same ASM version 9.7.

Testing done

CI build

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Fixes #1730

And drop deprecated AetherModule.
@cstamas
Copy link
Contributor Author

cstamas commented Sep 24, 2024

This uses sisu w/ index. Basically whatever you "throw" onto classpath (by adding resolver module JARs as maven dependencies), like new transport, new checksum, yada-yada it will be discovered and will be added to Resolver system. Currently only file and http transports are added.

Edit: clear up "module" (guice? jpms? maven?) -- point is, it now uses Sisu index, and if new sisu index is present on classpath, sisu will discover it and add to system.

@cstamas
Copy link
Contributor Author

cstamas commented Sep 24, 2024

Also, using asm-less guice and sisu, and provided latest asm (as asm was already present as transitive).

@basil basil changed the title Just an attempt to simply use Sisu Migrate from deprecated org.eclipse.aether.impl.guice.AetherModule to Sisu Sep 24, 2024
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

Many thanks for helping us across through this migration! I can't say I understand everything that is going on here, and getting even close to this would have taken me several days, so this is highly appreciated.

The comments I left are optional, for your consideration. I will leave this open a little longer in case other maintainers have thoughts about this, but as-is it looks good to me.

<maven.version>3.9.6</maven.version>
<maven-sisu.version>0.9.0.M3</maven-sisu.version>
Copy link
Member

Choose a reason for hiding this comment

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

According to https://github.com/apache/maven/blob/maven-3.9.6/pom.xml#L130 Maven 3.9.6 uses 0.9.0.M2, so I think this should be 0.9.0.M2 in order to follow the comment two lines earlier ("Keep them aligned to Maven version"):

Suggested change
<maven-sisu.version>0.9.0.M3</maven-sisu.version>
<maven-sisu.version>0.9.0.M2</maven-sisu.version>

Please feel free to ignore this suggestion if I have misunderstood the intention of the comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, let be consistent and have them truly aligned. Also, checked, and M2 does provide no_asm as well:
https://repo.maven.apache.org/maven2/org/eclipse/sisu/org.eclipse.sisu.inject/0.9.0.M2/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In reality does not stir much (as Sisu versions were more important due shaded in Asm, but now you use own ASM), also I don't want to kill current CI jobs, so please merge this suggestion before merging the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, 0.9.0.M2 does not have "strict" mode, so if downgrading, this will need change:
remove "false" after INDEX here https://github.com/jenkinsci/acceptance-test-harness/pull/1733/files#diff-14b9e71c9ede5549e786ac9e299d0b2da2969ff999f9c0a9ad55a3849d8abca2R40

pom.xml Show resolved Hide resolved
pom.xml Show resolved Hide resolved
@basil basil requested a review from a team September 24, 2024 19:23
@basil basil marked this pull request as ready for review September 24, 2024 19:24
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Thanks! I had the same questions as Basil on the classifiers, rest looks good if it works 😄

Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

Thanks!

@basil basil enabled auto-merge (squash) September 24, 2024 19:37
@cstamas
Copy link
Contributor Author

cstamas commented Sep 24, 2024

Yes, both Guice and Sisu contains shaded in ASM. Since Guice 4 and Sisu 0.9.0.M2 (? unsure) both projects offer "no asm shaded" artifacts as well (w/ classifier, Guice classes and Sisu no_asm). Basically you had 3 ASMs on classpath (2 shaded and 3rd was some transitive). Now you have one ASM that is latest.

.in(Singleton.class);
@Override
protected void configure() {
ClassSpace space = new URLClassSpace(RepositorySystem.class.getClassLoader());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe inspect: is TCCL "more appropriate here"?

@basil basil merged commit 60e25a7 into jenkinsci:master Sep 24, 2024
25 checks passed
@cstamas cstamas deleted the use-sisu branch September 24, 2024 20:35
@cstamas
Copy link
Contributor Author

cstamas commented Sep 24, 2024

One more thing post merge @basil and @timja I just realized:
While debugging, I kinda saw that AetherModule is constructed twice (I may be wrong here) per test.

But in any case, I am pretty much sure that RepositorySystem is not being extended dynamically (as in added new transport, removed transport), so to me it seems likely possible you need one cached instance of RepositorySystem. There is no reason to build and then tear down it, as it is same. RepositorySystem is stateless, while RepositorySystemSession is not (!).

So I think your lengthy tests could be mildly improved, if you split the two: keep RepositorySystem across whole run (as it has huge object graph, but is stateless and you do not change it), but create RepositorySystemSession per-case basis.

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

Successfully merging this pull request may close these issues.

Migrate from deprecated org.eclipse.aether.impl.guice.AetherModule to Sisu
3 participants