Revert "Fix MojangMappingsSpec having the same hash version for each mc version."
This reverts commit 61fa4d9f
dev/0.11
parent
61fa4d9fb6
commit
e6793b5ed7
|
@ -75,7 +75,9 @@ public interface LoomGradleExtension extends LoomGradleExtensionAPI {
|
||||||
|
|
||||||
JarProcessorManager getJarProcessorManager();
|
JarProcessorManager getJarProcessorManager();
|
||||||
|
|
||||||
MinecraftProviderImpl getMinecraftProvider();
|
default MinecraftProviderImpl getMinecraftProvider() {
|
||||||
|
return getDependencyManager().getProvider(MinecraftProviderImpl.class);
|
||||||
|
}
|
||||||
|
|
||||||
default MappingsProviderImpl getMappingsProvider() {
|
default MappingsProviderImpl getMappingsProvider() {
|
||||||
return getDependencyManager().getProvider(MappingsProviderImpl.class);
|
return getDependencyManager().getProvider(MappingsProviderImpl.class);
|
||||||
|
|
|
@ -30,21 +30,15 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import org.gradle.api.Action;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProvider;
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.intermediary.IntermediaryMappingsSpec;
|
import net.fabricmc.loom.configuration.providers.mappings.intermediary.IntermediaryMappingsSpec;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.mojmap.MojangMappingsSpec;
|
import net.fabricmc.loom.configuration.providers.mappings.mojmap.MojangMappingsSpec;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.parchment.ParchmentMappingsSpecBuilder;
|
import net.fabricmc.loom.configuration.providers.mappings.parchment.ParchmentMappingsSpecBuilder;
|
||||||
|
|
||||||
public class LayeredMappingSpecBuilder {
|
public class LayeredMappingSpecBuilder {
|
||||||
private final List<MappingsSpec<?>> layers = new LinkedList<>();
|
private final List<MappingsSpec<?>> layers = new LinkedList<>();
|
||||||
private final MinecraftProvider minecraftProvider;
|
|
||||||
|
|
||||||
public LayeredMappingSpecBuilder(MinecraftProvider minecraftProvider) {
|
|
||||||
this.minecraftProvider = minecraftProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LayeredMappingSpecBuilder officialMojangMappings() {
|
public LayeredMappingSpecBuilder officialMojangMappings() {
|
||||||
layers.add(new MojangMappingsSpec(minecraftProvider.minecraftVersion()));
|
layers.add(new MojangMappingsSpec());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import net.fabricmc.loom.configuration.providers.mappings.MappingContext;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
||||||
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
||||||
|
|
||||||
public record MojangMappingsSpec(String minecraftVersion) implements MappingsSpec<MojangMappingLayer> {
|
public record MojangMappingsSpec() implements MappingsSpec<MojangMappingLayer> {
|
||||||
// Keys in dependency manifest
|
// Keys in dependency manifest
|
||||||
private static final String MANIFEST_CLIENT_MAPPINGS = "client_mappings";
|
private static final String MANIFEST_CLIENT_MAPPINGS = "client_mappings";
|
||||||
private static final String MANIFEST_SERVER_MAPPINGS = "server_mappings";
|
private static final String MANIFEST_SERVER_MAPPINGS = "server_mappings";
|
||||||
|
|
|
@ -36,12 +36,11 @@ import org.gradle.api.artifacts.Dependency;
|
||||||
import org.gradle.api.file.ConfigurableFileCollection;
|
import org.gradle.api.file.ConfigurableFileCollection;
|
||||||
import org.gradle.api.plugins.BasePluginConvention;
|
import org.gradle.api.plugins.BasePluginConvention;
|
||||||
|
|
||||||
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
|
||||||
import net.fabricmc.loom.api.MixinApExtensionAPI;
|
import net.fabricmc.loom.api.MixinApExtensionAPI;
|
||||||
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
||||||
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
||||||
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
||||||
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProvider;
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.GradleMappingContext;
|
import net.fabricmc.loom.configuration.providers.mappings.GradleMappingContext;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpec;
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpec;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpecBuilder;
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpecBuilder;
|
||||||
|
@ -114,7 +113,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dependency layered(Action<LayeredMappingSpecBuilder> action) {
|
public Dependency layered(Action<LayeredMappingSpecBuilder> action) {
|
||||||
LayeredMappingSpecBuilder builder = new LayeredMappingSpecBuilder(getMinecraftProvider());
|
LayeredMappingSpecBuilder builder = new LayeredMappingSpecBuilder();
|
||||||
action.execute(builder);
|
action.execute(builder);
|
||||||
LayeredMappingSpec builtSpec = builder.build();
|
LayeredMappingSpec builtSpec = builder.build();
|
||||||
return new LayeredMappingsDependency(new GradleMappingContext(getProject(), "layers_" + builtSpec.getVersion().replace("+", "_").replace(".", "_")), builtSpec, builtSpec.getVersion());
|
return new LayeredMappingsDependency(new GradleMappingContext(getProject(), "layers_" + builtSpec.getVersion().replace("+", "_").replace(".", "_")), builtSpec, builtSpec.getVersion());
|
||||||
|
@ -183,8 +182,6 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
|
||||||
|
|
||||||
protected abstract MixinApExtension getMixinApExtension();
|
protected abstract MixinApExtension getMixinApExtension();
|
||||||
|
|
||||||
protected abstract MinecraftProvider getMinecraftProvider();
|
|
||||||
|
|
||||||
// This is here to ensure that LoomGradleExtensionApiImpl compiles without any unimplemented methods
|
// This is here to ensure that LoomGradleExtensionApiImpl compiles without any unimplemented methods
|
||||||
private final class EnsureCompile extends LoomGradleExtensionApiImpl {
|
private final class EnsureCompile extends LoomGradleExtensionApiImpl {
|
||||||
private EnsureCompile() {
|
private EnsureCompile() {
|
||||||
|
@ -206,10 +203,5 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
|
||||||
protected MixinApExtension getMixinApExtension() {
|
protected MixinApExtension getMixinApExtension() {
|
||||||
throw new RuntimeException("Yeah... something is really wrong");
|
throw new RuntimeException("Yeah... something is really wrong");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected MinecraftProvider getMinecraftProvider() {
|
|
||||||
throw new RuntimeException("Yeah... something is really wrong");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.configuration.InstallerData;
|
import net.fabricmc.loom.configuration.InstallerData;
|
||||||
import net.fabricmc.loom.configuration.LoomDependencyManager;
|
import net.fabricmc.loom.configuration.LoomDependencyManager;
|
||||||
import net.fabricmc.loom.configuration.processors.JarProcessorManager;
|
import net.fabricmc.loom.configuration.processors.JarProcessorManager;
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProviderImpl;
|
|
||||||
|
|
||||||
public class LoomGradleExtensionImpl extends LoomGradleExtensionApiImpl implements LoomGradleExtension {
|
public class LoomGradleExtensionImpl extends LoomGradleExtensionApiImpl implements LoomGradleExtension {
|
||||||
private final Project project;
|
private final Project project;
|
||||||
|
@ -111,11 +110,6 @@ public class LoomGradleExtensionImpl extends LoomGradleExtensionApiImpl implemen
|
||||||
return Objects.requireNonNull(jarProcessorManager, "Cannot get JarProcessorManager before it has been setup");
|
return Objects.requireNonNull(jarProcessorManager, "Cannot get JarProcessorManager before it has been setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MinecraftProviderImpl getMinecraftProvider() {
|
|
||||||
return getDependencyManager().getProvider(MinecraftProviderImpl.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingSet getOrCreateSrcMappingCache(int id, Supplier<MappingSet> factory) {
|
public MappingSet getOrCreateSrcMappingCache(int id, Supplier<MappingSet> factory) {
|
||||||
return srcMappingCache[id] != null ? srcMappingCache[id] : (srcMappingCache[id] = factory.get());
|
return srcMappingCache[id] != null ? srcMappingCache[id] : (srcMappingCache[id] = factory.get());
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.test.unit.layeredmappings
|
package net.fabricmc.loom.test.unit.layeredmappings
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProvider
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpec
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpec
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpecBuilder
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpecBuilder
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.intermediary.IntermediaryMappingsSpec
|
import net.fabricmc.loom.configuration.providers.mappings.intermediary.IntermediaryMappingsSpec
|
||||||
|
@ -35,41 +34,20 @@ import org.gradle.util.ConfigureUtil
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class LayeredMappingSpecBuilderTest extends Specification {
|
class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
MinecraftProvider mockMinecraftProvider = Mock(MinecraftProvider)
|
|
||||||
|
|
||||||
def "simple mojmap" () {
|
def "simple mojmap" () {
|
||||||
setup:
|
|
||||||
mockMinecraftProvider.minecraftVersion() >> "1.17"
|
|
||||||
when:
|
when:
|
||||||
def spec = layered() {
|
def spec = layered() {
|
||||||
officialMojangMappings()
|
officialMojangMappings()
|
||||||
}
|
}
|
||||||
def layers = spec.layers()
|
def layers = spec.layers()
|
||||||
then:
|
then:
|
||||||
spec.version == "layered+hash.1506500"
|
spec.version == "layered+hash.961"
|
||||||
layers.size() == 2
|
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
|
||||||
layers[1].class == MojangMappingsSpec
|
|
||||||
}
|
|
||||||
|
|
||||||
def "simple mojmap alternative version" () {
|
|
||||||
setup:
|
|
||||||
mockMinecraftProvider.minecraftVersion() >> "1.17.1"
|
|
||||||
when:
|
|
||||||
def spec = layered() {
|
|
||||||
officialMojangMappings()
|
|
||||||
}
|
|
||||||
def layers = spec.layers()
|
|
||||||
then:
|
|
||||||
spec.version == "layered+hash.1446825415"
|
|
||||||
layers.size() == 2
|
layers.size() == 2
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
def "simple mojmap with parchment" () {
|
def "simple mojmap with parchment" () {
|
||||||
setup:
|
|
||||||
mockMinecraftProvider.minecraftVersion() >> "1.17"
|
|
||||||
when:
|
when:
|
||||||
def spec = layered() {
|
def spec = layered() {
|
||||||
officialMojangMappings()
|
officialMojangMappings()
|
||||||
|
@ -78,7 +56,7 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
def layers = spec.layers()
|
def layers = spec.layers()
|
||||||
def parchment = layers[2] as ParchmentMappingsSpec
|
def parchment = layers[2] as ParchmentMappingsSpec
|
||||||
then:
|
then:
|
||||||
spec.version == "layered+hash.910386113"
|
spec.version == "layered+hash.863714404"
|
||||||
layers.size() == 3
|
layers.size() == 3
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
|
@ -88,8 +66,6 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
def "simple mojmap with parchment keep prefix" () {
|
def "simple mojmap with parchment keep prefix" () {
|
||||||
setup:
|
|
||||||
mockMinecraftProvider.minecraftVersion() >> "1.17"
|
|
||||||
when:
|
when:
|
||||||
def spec = layered() {
|
def spec = layered() {
|
||||||
officialMojangMappings()
|
officialMojangMappings()
|
||||||
|
@ -100,7 +76,7 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
def layers = spec.layers()
|
def layers = spec.layers()
|
||||||
def parchment = layers[2] as ParchmentMappingsSpec
|
def parchment = layers[2] as ParchmentMappingsSpec
|
||||||
then:
|
then:
|
||||||
spec.version == "layered+hash.910386119"
|
spec.version == "layered+hash.863714410"
|
||||||
layers.size() == 3
|
layers.size() == 3
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
|
@ -110,8 +86,6 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
def "simple mojmap with parchment keep prefix alternate hash" () {
|
def "simple mojmap with parchment keep prefix alternate hash" () {
|
||||||
setup:
|
|
||||||
mockMinecraftProvider.minecraftVersion() >> "1.17"
|
|
||||||
when:
|
when:
|
||||||
def spec = layered() {
|
def spec = layered() {
|
||||||
officialMojangMappings()
|
officialMojangMappings()
|
||||||
|
@ -122,7 +96,7 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
def layers = spec.layers()
|
def layers = spec.layers()
|
||||||
def parchment = layers[2] as ParchmentMappingsSpec
|
def parchment = layers[2] as ParchmentMappingsSpec
|
||||||
then:
|
then:
|
||||||
spec.version == "layered+hash.1097793778"
|
spec.version == "layered+hash.1144465487"
|
||||||
layers.size() == 3
|
layers.size() == 3
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
|
@ -137,7 +111,7 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
LayeredMappingSpec layeredAction(Action<LayeredMappingSpecBuilder> action) {
|
LayeredMappingSpec layeredAction(Action<LayeredMappingSpecBuilder> action) {
|
||||||
LayeredMappingSpecBuilder builder = new LayeredMappingSpecBuilder(mockMinecraftProvider)
|
LayeredMappingSpecBuilder builder = new LayeredMappingSpecBuilder()
|
||||||
action.execute(builder)
|
action.execute(builder)
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class MojangMappingLayerTest extends LayeredMappingsSpecification {
|
||||||
when:
|
when:
|
||||||
def mappings = getLayeredMappings(
|
def mappings = getLayeredMappings(
|
||||||
new IntermediaryMappingsSpec(),
|
new IntermediaryMappingsSpec(),
|
||||||
new MojangMappingsSpec("1.17")
|
new MojangMappingsSpec()
|
||||||
)
|
)
|
||||||
def tiny = getTiny(mappings)
|
def tiny = getTiny(mappings)
|
||||||
then:
|
then:
|
||||||
|
|
Loading…
Reference in New Issue