Fix compile for b320c4199a (#480)

* Fix compile for b320c4199a

* Fix checkstyle
dev/0.11
shedaniel 2021-08-26 18:22:55 +08:00 committed by GitHub
parent b320c4199a
commit 2277b93f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -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();