parent
b320c4199a
commit
2277b93f8d
|
@ -35,14 +35,13 @@ import org.gradle.api.plugins.PluginAware;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import net.fabricmc.loom.extension.LoomFiles;
|
import net.fabricmc.loom.extension.LoomFiles;
|
||||||
|
|
||||||
import net.fabricmc.loom.util.MirrorUtil;
|
import net.fabricmc.loom.util.MirrorUtil;
|
||||||
|
|
||||||
public class LoomRepositoryPlugin implements Plugin<PluginAware> {
|
public class LoomRepositoryPlugin implements Plugin<PluginAware> {
|
||||||
@Override
|
@Override
|
||||||
public void apply(@NotNull PluginAware target) {
|
public void apply(@NotNull PluginAware target) {
|
||||||
if (target instanceof Settings settings) {
|
if (target instanceof Settings settings) {
|
||||||
declareRepositories(settings.getDependencyResolutionManagement().getRepositories(), LoomFiles.create(settings));
|
declareRepositories(settings.getDependencyResolutionManagement().getRepositories(), LoomFiles.create(settings), settings);
|
||||||
|
|
||||||
// leave a marker so projects don't try to override these
|
// leave a marker so projects don't try to override these
|
||||||
settings.getGradle().getPluginManager().apply(LoomRepositoryPlugin.class);
|
settings.getGradle().getPluginManager().apply(LoomRepositoryPlugin.class);
|
||||||
|
@ -51,7 +50,7 @@ public class LoomRepositoryPlugin implements Plugin<PluginAware> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
declareRepositories(project.getRepositories(), LoomFiles.create(project));
|
declareRepositories(project.getRepositories(), LoomFiles.create(project), project);
|
||||||
} else if (target instanceof Gradle) {
|
} else if (target instanceof Gradle) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,18 +58,18 @@ public class LoomRepositoryPlugin implements Plugin<PluginAware> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void declareRepositories(RepositoryHandler repositories, LoomFiles files) {
|
private void declareRepositories(RepositoryHandler repositories, LoomFiles files, ExtensionAware target) {
|
||||||
repositories.maven(repo -> {
|
repositories.maven(repo -> {
|
||||||
repo.setName("UserLocalRemappedMods");
|
repo.setName("UserLocalRemappedMods");
|
||||||
repo.setUrl(files.getRemappedModCache());
|
repo.setUrl(files.getRemappedModCache());
|
||||||
});
|
});
|
||||||
repositories.maven(repo -> {
|
repositories.maven(repo -> {
|
||||||
repo.setName("Fabric");
|
repo.setName("Fabric");
|
||||||
repo.setUrl(MirrorUtil.getFabricRepository((ExtensionAware) target));
|
repo.setUrl(MirrorUtil.getFabricRepository(target));
|
||||||
});
|
});
|
||||||
repositories.maven(repo -> {
|
repositories.maven(repo -> {
|
||||||
repo.setName("Mojang");
|
repo.setName("Mojang");
|
||||||
repo.setUrl(MirrorUtil.getLibrariesBase((ExtensionAware) target));
|
repo.setUrl(MirrorUtil.getLibrariesBase(target));
|
||||||
});
|
});
|
||||||
repositories.mavenCentral();
|
repositories.mavenCentral();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue