DependencyDownloader: Support platform dependencies

This commit is contained in:
Juuz
2024-01-24 20:05:25 +02:00
parent f1df58a5f3
commit dfbdf26678

View File

@@ -65,6 +65,17 @@ public final class DependencyDownloader {
return this;
}
/**
* Adds a platform dependency.
*
* @param dependencyNotation the dependency notation
* @return this downloader
*/
public DependencyDownloader platform(String dependencyNotation) {
dependencies.add(new DependencyEntry.Platform(dependencyNotation));
return this;
}
/**
* Adds all dependencies from a configuration to download.
*
@@ -137,6 +148,10 @@ public final class DependencyDownloader {
if (resolve) {
files = project.files(files.getFiles());
for (File file : files) {
System.out.println(file.getAbsolutePath());
}
}
return files;
@@ -190,6 +205,13 @@ public final class DependencyDownloader {
}
}
record Platform(String notation) implements DependencyEntry {
@Override
public Dependency getDependency(DependencyHandler dependencies, boolean transitive) {
return dependencies.platform(notation);
}
}
record Direct(Dependency dependency) implements DependencyEntry {
@Override
public Dependency getDependency(DependencyHandler dependencies, boolean transitive) {