Class DependencyDownloader

java.lang.Object
dev.architectury.loom.util.DependencyDownloader

public final class DependencyDownloader extends Object
A simple API to resolve dependencies as a file collection.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DependencyDownloader(org.gradle.api.Project project)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String dependencyNotation)
    Adds 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>
    DependencyDownloader
    attribute(org.gradle.api.attributes.Attribute<T> attribute, String name)
    Adds 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.FileCollection
    Resolves the dependencies as well as their transitive dependencies into a FileCollection.
    org.gradle.api.file.FileCollection
    download(boolean transitive, boolean resolve)
    Resolves a dependency as well as its transitive dependencies into a FileCollection.
    static org.gradle.api.file.FileCollection
    download(org.gradle.api.Project project, String dependencyNotation)
    Resolves a dependency as well as its transitive dependencies into a FileCollection.
    static org.gradle.api.file.FileCollection
    download(org.gradle.api.Project project, String dependencyNotation, boolean transitive, boolean resolve)
     
    platform(String dependencyNotation)
    Adds a platform dependency.
    static Set<File>
    resolveFiles(org.gradle.api.Project project, org.gradle.api.artifacts.Configuration configuration, boolean transitive)
    Resolves a configuration and its superconfigurations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DependencyDownloader

      public DependencyDownloader(org.gradle.api.Project project)
  • Method Details

    • add

      public DependencyDownloader add(String dependencyNotation)
      Adds a dependency to download.
      Parameters:
      dependencyNotation - the dependency notation
      Returns:
      this downloader
    • platform

      public DependencyDownloader platform(String dependencyNotation)
      Adds a platform dependency.
      Parameters:
      dependencyNotation - the dependency notation
      Returns:
      this downloader
    • addAll

      public DependencyDownloader addAll(org.gradle.api.artifacts.Configuration configuration)
      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 attribute
      value - 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 attribute
      name - 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 a FileCollection.
      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 a FileCollection.
      Parameters:
      transitive - whether to include transitive dependencies
      resolve - 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 a FileCollection.
      Parameters:
      project - the project needing these files
      dependencyNotation - 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 resolve
      transitive - true if transitive dependencies should be included, false otherwise
      Returns:
      a mutable set containing the resolved files of the configuration