Slackbot
07/04/2023, 4:19 PMSebastian Schuberth
07/04/2023, 4:53 PMgetRepositoryId from Gradle 8.2 on.Eli Graber
07/04/2023, 5:01 PMSebastian Schuberth
07/04/2023, 5:03 PMgetRepositoryName. They just introduced a different function for basically the same thing in order to be able to change its semantics, I guess.Eli Graber
07/04/2023, 5:04 PMgetRepositoryName was returning the name of the repository (e.g. Google, MavenRepo, etc...). Now getRepositoryId returns something like 26c913274550a0b2221f47a0fe2d2358Sebastian Schuberth
07/04/2023, 5:06 PMEli Graber
07/04/2023, 5:12 PMgetRepositoryName now returns the same value as getRepositoryId (e.g. 26c913274550a0b2221f47a0fe2d2358)Sebastian Schuberth
07/04/2023, 5:15 PMproject.repositories.name with UrlArtifactRepository. That still seems to work.Eli Graber
07/04/2023, 5:25 PMEli Graber
07/04/2023, 5:26 PMprivate Map<String, ArtifactRepository> getAllRepositories(Project project) {
Map<String, ArtifactRepository> projectRepositories = project.getRepositories().getAsMap();
// nasty cast because of <https://github.com/gradle/gradle/issues/17295>
Map<String, ArtifactRepository> settingsRepositories =
((GradleInternal) project.getGradle())
.getSettings()
.getDependencyResolutionManagement()
.getRepositories()
.getAsMap();
settingsRepositories.putAll(projectRepositories);
return settingsRepositories;
}Eli Graber
07/04/2023, 5:28 PMgetRepositoryName (and now getRepositoryId ) as a key into that map, but it returns the hex string id:
((ResolvedComponentResultInternal) resolvedComponentResult).getRepositoryName();Sebastian Schuberth
07/04/2023, 5:34 PMgetAsMap() do exactly? I.e., how does it know what's supposed to be the key, and what the value? In Kotlin, I'm doing the association explicitly, see https://github.com/oss-review-toolkit/ort/blob/6e68575eefb693307170d9b7af978260fa1[…]ckage-managers/gradle-plugin/src/main/kotlin/OrtModelBuilder.ktSebastian Schuberth
07/04/2023, 5:35 PMEli Graber
07/04/2023, 5:37 PMgetAsMap is a function on NamedDomainObjectCollection that returns a map of associated names to values.Eli Graber
07/04/2023, 5:41 PMSebastian Schuberth
07/04/2023, 5:48 PMgetAsMap also works to make the lookup work...Sebastian Schuberth
07/04/2023, 5:51 PMEli Graber
07/04/2023, 5:51 PMname gets exposed for maven repos anymore.Sebastian Schuberth
07/04/2023, 5:52 PMEli Graber
07/04/2023, 6:25 PMEli Graber
07/04/2023, 7:01 PMdelegate in the CachingModuleComponentRegistry that is used to supply the repository id for the ResolvedGraphComponent ) getting the MavenRepositoryDescriptor that contains the repository name and hashed id.
However the repository name doesn't get used anywhere as far as I can tell. Is the project that is applying your plugin using Gradle 8.2?Eli Graber
07/04/2023, 7:20 PMResolvedComponentResultInternal.getRepositoryName is deprecated and the doc says not to use it, but it is the only way to get that information as far as I can tell. This behavior change was not documented in the release notes for Grade 8.2.
Any idea on when this will be supported again?