Hi,
I’m working to make a Gradle plugin to manipulate dependencies and downloaded files. My question here is: How can I couple DependencyResult and downloaded files from ResolvableDependencies.
final ResolvableDependencies resolvable = configuration.getIncoming();
// Set of downloaded files
final FileCollection fileCollection = resolvable.getFiles();
final Set<File> files = resolvable.getFiles().getFiles();
// DependencyResults
final ResolutionResult results = resolvable.getResolutionResult();
final Set<DependencyResult> dependencies = results.getAllDependencies();
I can get each independent Set of:
- downloaded files … such as
.../.gradle/caches/modules-2/files-2.1/com.example/example-module/0.6.0/f8403641bc17ad3c60250a97ad898514ffd0170a/example-module-0.6.0.jar, … DependencyResults – such asResolvedDependencyResultthat include the component ID likecom.example:example-module:0.6.0.
However, I was not sure how I can “map” a downloaded file and a DependencyResult – in other words, I wanted to know which downloaded file (.../example-module-0.6.0.jar) is for which component (com.example:example-module:0.6.0).
I could do a hack with file names (the file example-module-0.6.0.jar should be of com.example:example-module:0.6.0, right?), but it’s uncertain.
I wanted to know a more certain way to couple DependencyResult and downloaded files from ResolvableDependencies.
Thanks.