parallel library downloads

This commit is contained in:
FalsePattern committed 2022-08-06 14:18:27 +02:00
1 parent da1ef6c8c7
commit a19adf283f
4 files changed
+278 -18

No files matched your search

@@ -20,11 +20,14 @@
*/
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.DeprecationDetails;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.FalsePatternLib;
import com.falsepattern.lib.internal.impl.dependencies.DependencyLoaderImpl;
import lombok.Builder;
import lombok.NonNull;
import java.util.concurrent.CompletableFuture;
@StableAPI(since = "0.6.0")
public class DependencyLoader {
@@ -34,10 +37,117 @@ public class DependencyLoader {
DependencyLoaderImpl.addMavenRepo(url);
}
@Builder
@StableAPI.Expose(since = "0.10.0")
public static CompletableFuture<Void> loadLibrariesAsync(Library... libraries) {
return DependencyLoaderImpl.loadLibrariesAsync(libraries);
}
@StableAPI.Expose(since = "0.10.0")
public static void loadLibraries(Library... libraries) {
DependencyLoaderImpl.loadLibraries(libraries);
}
@Deprecated
@DeprecationDetails(deprecatedSince = "0.10.0")
@StableAPI.Expose
public static void loadLibrary(@NonNull String loadingModId, @NonNull String groupId, @NonNull String artifactId, @NonNull Version minVersion, Version maxVersion, @NonNull Version preferredVersion, String regularSuffix, String devSuffix) {
FalsePatternLib.getLog().warn(DependencyLoader.class.getName() + ".loadLibrary is deprecated and will be removed in FalsePatternLib 0.11! Use loadLibraries instead!");
DependencyLoaderImpl.loadLibrary(loadingModId, groupId, artifactId, minVersion, maxVersion, preferredVersion,
regularSuffix, devSuffix);
}
@DeprecationDetails(deprecatedSince = "0.10.0")
@StableAPI.Expose
@Deprecated
public static VoidBuilder builder() {
return new VoidBuilder();
}
@StableAPI(since = "0.6.0")
@DeprecationDetails(deprecatedSince = "0.10.0")
public static class VoidBuilder {
private String loadingModId;
private String groupId;
private String artifactId;
private Version minVersion;
private Version maxVersion;
private Version preferredVersion;
private String regularSuffix;
private String devSuffix;
@Deprecated
VoidBuilder() {
}
@StableAPI.Expose
@Deprecated
public VoidBuilder loadingModId(@NonNull String loadingModId) {
this.loadingModId = loadingModId;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder groupId(@NonNull String groupId) {
this.groupId = groupId;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder artifactId(@NonNull String artifactId) {
this.artifactId = artifactId;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder minVersion(@NonNull Version minVersion) {
this.minVersion = minVersion;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder maxVersion(Version maxVersion) {
this.maxVersion = maxVersion;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder preferredVersion(@NonNull Version preferredVersion) {
this.preferredVersion = preferredVersion;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder regularSuffix(String regularSuffix) {
this.regularSuffix = regularSuffix;
return this;
}
@StableAPI.Expose
@Deprecated
public VoidBuilder devSuffix(String devSuffix) {
this.devSuffix = devSuffix;
return this;
}
@StableAPI.Expose
@Deprecated
public void build() {
DependencyLoader.loadLibrary(loadingModId, groupId, artifactId, minVersion, maxVersion, preferredVersion,
regularSuffix, devSuffix);
}
@Override
public String toString() {
return "DependencyLoader.VoidBuilder(loadingModId=" + this.loadingModId + ", groupId=" + this.groupId +
", artifactId=" + this.artifactId + ", minVersion=" + this.minVersion + ", maxVersion=" +
this.maxVersion + ", preferredVersion=" + this.preferredVersion + ", regularSuffix=" +
this.regularSuffix + ", devSuffix=" + this.devSuffix + ")";
}
}
}