Update to DependencyDownload 2.0.0-SNAPSHOT

This commit is contained in:
Vankka 2024-12-14 00:04:36 +02:00
parent fd47e8ba7e
commit 312159e9ec
No known key found for this signature in database
GPG Key ID: 62E48025ED4E7EBB
3 changed files with 12 additions and 9 deletions

View File

@ -22,8 +22,10 @@ import com.discordsrv.common.DiscordSRV;
import dev.vankka.dependencydownload.DependencyManager;
import dev.vankka.dependencydownload.classloader.IsolatedClassLoader;
import dev.vankka.dependencydownload.classpath.ClasspathAppender;
import dev.vankka.dependencydownload.path.DependencyPathProvider;
import dev.vankka.dependencydownload.repository.MavenRepository;
import dev.vankka.dependencydownload.repository.Repository;
import dev.vankka.dependencydownload.repository.StandardRepository;
import dev.vankka.dependencydownload.resource.DependencyDownloadResource;
import java.io.IOException;
import java.net.URL;
@ -37,10 +39,10 @@ public class DependencyLoader {
private static final List<Repository> REPOSITORIES = Arrays.asList(
// TODO
new StandardRepository("https://repo1.maven.org/maven2"),
new StandardRepository("https://oss.sonatype.org/content/repositories/snapshots"),
new StandardRepository("https://s01.oss.sonatype.org/content/repositories/snapshots"),
new StandardRepository("https://nexus.scarsz.me/content/groups/public")
new MavenRepository("https://repo1.maven.org/maven2"),
new MavenRepository("https://oss.sonatype.org/content/repositories/snapshots"),
new MavenRepository("https://s01.oss.sonatype.org/content/repositories/snapshots"),
new MavenRepository("https://nexus.scarsz.me/content/groups/public")
);
public static Path resolvePath(Path dataDirectory) {
@ -48,13 +50,13 @@ public class DependencyLoader {
}
public static DependencyManager fromPaths(Path dataDirectory, String[] resources) throws IOException {
DependencyManager dependencyManager = new DependencyManager(resolvePath(dataDirectory));
DependencyManager dependencyManager = new DependencyManager(DependencyPathProvider.directory(resolvePath(dataDirectory)));
for (String dependencyResource : resources) {
URL resource = DependencyLoader.class.getClassLoader().getResource(dependencyResource);
if (resource == null) {
throw new IllegalArgumentException("Could not find resource with: " + dependencyResource);
}
dependencyManager.loadFromResource(resource);
dependencyManager.loadResource(DependencyDownloadResource.parse(resource));
}
return dependencyManager;

View File

@ -21,6 +21,7 @@ package com.discordsrv.common.core.dependency;
import com.discordsrv.common.DiscordSRV;
import dev.vankka.dependencydownload.ApplicationDependencyManager;
import dev.vankka.dependencydownload.DependencyManager;
import dev.vankka.dependencydownload.path.DependencyPathProvider;
import java.io.IOException;
import java.nio.file.Path;
@ -33,7 +34,7 @@ public class DiscordSRVDependencyManager {
public DiscordSRVDependencyManager(DiscordSRV discordSRV, DependencyLoader initialLoader) {
this.discordSRV = discordSRV;
Path cacheDirectory = DependencyLoader.resolvePath(discordSRV.dataDirectory());
this.dependencyManager = new ApplicationDependencyManager(cacheDirectory);
this.dependencyManager = new ApplicationDependencyManager(DependencyPathProvider.directory(cacheDirectory));
if (initialLoader != null) {
dependencyManager.include(initialLoader.getDependencyManager());

View File

@ -41,7 +41,7 @@ dependencyResolutionManagement {
library('velocity', 'com.velocitypowered', 'velocity-api').version('3.3.0-SNAPSHOT')
// DependencyDownload
version('dependencydownload', '1.3.1')
version('dependencydownload', '2.0.0-SNAPSHOT')
plugin('dependencydownload-plugin', 'dev.vankka.dependencydownload.plugin').versionRef('dependencydownload')
library('dependencydownload-runtime', 'dev.vankka', 'dependencydownload-runtime').versionRef('dependencydownload')
library('dependencydownload-jarinjar-bootstrap', 'dev.vankka', 'dependencydownload-jarinjar-bootstrap').versionRef('dependencydownload')