Skip to content

Commit

Permalink
DependencyDownloader: Support platform dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Jan 24, 2024
1 parent f1df58a commit dfbdf26
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/net/fabricmc/loom/util/DependencyDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ public DependencyDownloader add(String dependencyNotation) {
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.
*
Expand Down Expand Up @@ -137,6 +148,10 @@ public FileCollection download(boolean transitive, boolean resolve) {

if (resolve) {
files = project.files(files.getFiles());

for (File file : files) {
System.out.println(file.getAbsolutePath());
}
}

return files;
Expand Down Expand Up @@ -190,6 +205,13 @@ public Dependency getDependency(DependencyHandler dependencies, boolean transiti
}
}

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) {
Expand Down

0 comments on commit dfbdf26

Please sign in to comment.