fix(Gradle): fix credentials checking in recent gradle releases#11887
fix(Gradle): fix credentials checking in recent gradle releases#11887losmateusz1 wants to merge 1 commit into
Conversation
2519f4b to
05e9a6d
Compare
Signed-off-by: Mateusz Los <mateusz.los@extern.wenovate.de>
05e9a6d to
089505a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11887 +/- ##
=========================================
Coverage 58.31% 58.31%
Complexity 1762 1762
=========================================
Files 356 356
Lines 13276 13276
Branches 1318 1318
=========================================
Hits 7742 7742
Misses 5049 5049
Partials 485 485
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| internal fun UrlArtifactRepository.toOrtRepository(): OrtRepository { | ||
| val credentials = (this as? AuthenticationSupported)?.credentials | ||
| val credentials = (this as? AuthenticationSupported)?.let { authSupported -> | ||
| runCatching { authSupported.getCredentials(PasswordCredentials::class.java) }.getOrNull() |
There was a problem hiding this comment.
Hmm. The original (parameter-less) getCredentials() function is still there (and Kotlin maps the getter to a property), so I'm unsure why this change should be needed.
There was a problem hiding this comment.
the difference is that I used getCredentials(Class) instead of getCredentials(), I am not sure yet why gradle 8.14 fails on that, it may be because of the configuration of the project that I am currently checking
I will look into it some more, for now I don't see a better solution, I've run some tests and this approach will also work with older gradle releases
There was a problem hiding this comment.
@sschuberth the problem in my case was that there was a settings.gradle defined with HttpHeaderAuthentication that I missed, which made me thinking that there is an issue with parsing PasswordCredentials, I started working on a proper fix here #11927
There was a problem hiding this comment.
So, should we close this PR already in favor of that other PR?
with recent gradle8 releases (8.13.x or 8.14.x) gradle inspector fails with
IllegalStateException: Can not use getCredentials() method when not using PasswordCredentials; please use getCredentials(Class)