Change mixin refmap default name to use archivesBaseName instead of the project name (#158)

* Change mixin refmap default name to use archivesBaseName instead of the project name

Using the project name can be problematic in libraries pulled in with Jitpack.
Jitpack clones projects in a directory called "build", which sets the
project name to "build" if not manually defined. The resulting refmap,
"build-refmap.json", can conflict with other mods' refmaps,
leading to mixin crashes.

* Shut up checkstyle
dev/0.11
Juuxel 2019-12-29 19:29:19 +02:00 committed by modmuss50
parent 5ef6125795
commit 705754de80
1 changed files with 4 additions and 2 deletions

View File

@ -43,6 +43,7 @@ import org.cadixdev.mercury.Mercury;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.plugins.BasePluginConvention;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.providers.MinecraftMappedProvider;
@ -284,8 +285,9 @@ public class LoomGradleExtension {
public String getRefmapName() {
if (refmapName == null || refmapName.isEmpty()) {
project.getLogger().warn("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json");
refmapName = project.getName() + "-refmap.json";
String defaultRefmapName = project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName() + "-refmap.json";
project.getLogger().warn("Could not find refmap definition, will be using default name: " + defaultRefmapName);
refmapName = defaultRefmapName;
}
return refmapName;