aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/fabricmc/loom/util/DependencyDownloader.java
blob: 7915073d28e63d9f32902878e431c01c7c59a400 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package net.fabricmc.loom.util;

import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;

/**
 * Simplified dependency downloading.
 *
 * @author Juuz
 */
public final class DependencyDownloader {
	/**
	 * Resolves a dependency as well as its transitive dependencies into a {@link FileCollection}.
	 *
	 * @param project            the project needing these files
	 * @param dependencyNotation the dependency notation
	 * @return the resolved files
	 */
	public static FileCollection download(Project project, String dependencyNotation) {
		var dependency = project.getDependencies().create(dependencyNotation);
		var config = project.getConfigurations().detachedConfiguration(dependency);
		return config.fileCollection(dep -> true);
	}
}