Package dev.architectury.loom.util
Class DependencyDownloader
java.lang.Object
dev.architectury.loom.util.DependencyDownloader
A simple API to resolve dependencies as a file collection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a dependency to download.addAll(org.gradle.api.artifacts.Configuration configuration) Adds all dependencies from a configuration to download.<T extends org.gradle.api.Named>
DependencyDownloaderAdds a named attribute to control the downloaded artifacts.attribute(org.gradle.api.attributes.Attribute<T> attribute, T value) Adds an attribute to control the downloaded artifacts.org.gradle.api.file.FileCollectiondownload()Resolves the dependencies as well as their transitive dependencies into aFileCollection.org.gradle.api.file.FileCollectiondownload(boolean transitive, boolean resolve) Resolves a dependency as well as its transitive dependencies into aFileCollection.static org.gradle.api.file.FileCollectionResolves a dependency as well as its transitive dependencies into aFileCollection.static org.gradle.api.file.FileCollectiondownload(org.gradle.api.Project project, String dependencyNotation, boolean transitive, boolean resolve) Adds a platform dependency.resolveFiles(org.gradle.api.Project project, org.gradle.api.artifacts.Configuration configuration, boolean transitive) Resolves a configuration and its superconfigurations.
-
Constructor Details
-
DependencyDownloader
public DependencyDownloader(org.gradle.api.Project project)
-
-
Method Details
-
add
Adds a dependency to download.- Parameters:
dependencyNotation- the dependency notation- Returns:
- this downloader
-
platform
Adds a platform dependency.- Parameters:
dependencyNotation- the dependency notation- Returns:
- this downloader
-
addAll
Adds all dependencies from a configuration to download.- Parameters:
configuration- the dependency configuration- Returns:
- this downloader
-
attribute
public <T> DependencyDownloader attribute(org.gradle.api.attributes.Attribute<T> attribute, T value) Adds an attribute to control the downloaded artifacts.- Type Parameters:
T- the value type- Parameters:
attribute- the attributevalue- the attribute's value- Returns:
- this downloader
-
attribute
public <T extends org.gradle.api.Named> DependencyDownloader attribute(org.gradle.api.attributes.Attribute<T> attribute, String name) Adds a named attribute to control the downloaded artifacts.- Type Parameters:
T- the value type- Parameters:
attribute- the attributename- the attribute's name- Returns:
- this downloader
-
download
public org.gradle.api.file.FileCollection download()Resolves the dependencies as well as their transitive dependencies into aFileCollection.- Returns:
- the resolved files
-
download
public org.gradle.api.file.FileCollection download(boolean transitive, boolean resolve) Resolves a dependency as well as its transitive dependencies into aFileCollection.- Parameters:
transitive- whether to include transitive dependenciesresolve- whether to eagerly resolve the file collection- Returns:
- the resolved files
-
download
public static org.gradle.api.file.FileCollection download(org.gradle.api.Project project, String dependencyNotation) Resolves a dependency as well as its transitive dependencies into aFileCollection.- Parameters:
project- the project needing these filesdependencyNotation- the dependency notation- Returns:
- the resolved files
-
download
public static org.gradle.api.file.FileCollection download(org.gradle.api.Project project, String dependencyNotation, boolean transitive, boolean resolve) -
resolveFiles
public static Set<File> resolveFiles(org.gradle.api.Project project, org.gradle.api.artifacts.Configuration configuration, boolean transitive) Resolves a configuration and its superconfigurations.Note that unlike resolving a recursive copy of the configuration, this method overrides the transitivity of all superconfigurations as well.
- Parameters:
configuration- the configuration to resolvetransitive- true if transitive dependencies should be included, false otherwise- Returns:
- a mutable set containing the resolved files of the configuration
-