Expose layered mappings as an API (#490)
* Expose layered mappings as an API * Add FileSpec * Cleanup and support DependencyFileSpecdev/0.11
parent
4f2ead9f16
commit
08e548b6c6
|
@ -38,9 +38,9 @@ import org.gradle.api.publish.maven.MavenPublication;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
|
||||||
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.mappings.LayeredMappingSpecBuilder;
|
|
||||||
import net.fabricmc.loom.util.DeprecationHelper;
|
import net.fabricmc.loom.util.DeprecationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,16 +22,22 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings;
|
package net.fabricmc.loom.api.mappings.layered;
|
||||||
|
|
||||||
import java.io.File;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import org.gradle.api.artifacts.Dependency;
|
||||||
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.Logger;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProvider;
|
import net.fabricmc.loom.configuration.providers.MinecraftProvider;
|
||||||
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProvider;
|
||||||
|
|
||||||
|
@ApiStatus.Experimental /* Very Experimental and not cleanly separated from the impl atm */
|
||||||
public interface MappingContext {
|
public interface MappingContext {
|
||||||
File mavenFile(String mavenNotation);
|
Path resolveDependency(Dependency dependency);
|
||||||
|
|
||||||
|
Path resolveMavenDependency(String mavenNotation);
|
||||||
|
|
||||||
MappingsProvider mappingsProvider();
|
MappingsProvider mappingsProvider();
|
||||||
|
|
||||||
|
@ -44,7 +50,7 @@ public interface MappingContext {
|
||||||
/**
|
/**
|
||||||
* Creates a temporary working dir to be used to store working files.
|
* Creates a temporary working dir to be used to store working files.
|
||||||
*/
|
*/
|
||||||
File workingDirectory(String name);
|
Path workingDirectory(String name);
|
||||||
|
|
||||||
Logger getLogger();
|
Logger getLogger();
|
||||||
}
|
}
|
|
@ -22,21 +22,28 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings;
|
package net.fabricmc.loom.api.mappings.layered;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
import net.fabricmc.mappingio.MappingVisitor;
|
import net.fabricmc.mappingio.MappingVisitor;
|
||||||
|
|
||||||
|
@ApiStatus.Experimental
|
||||||
public interface MappingLayer {
|
public interface MappingLayer {
|
||||||
void visit(MappingVisitor mappingVisitor) throws IOException;
|
void visit(MappingVisitor mappingVisitor) throws IOException;
|
||||||
|
|
||||||
default MappingNamespace getSourceNamespace() {
|
default MappingsNamespace getSourceNamespace() {
|
||||||
return MappingNamespace.NAMED;
|
return MappingsNamespace.NAMED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a list of layer classes that this mapping layer depends on. If such a layer is not present an Exception will be thrown when trying to resolve the layer.
|
||||||
|
* @return A list of MappingLayer classes to depend on.
|
||||||
|
*/
|
||||||
default List<Class<? extends MappingLayer>> dependsOn() {
|
default List<Class<? extends MappingLayer>> dependsOn() {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016-2021 FabricMC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.fabricmc.loom.api.mappings.layered;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The standard namespaces used by loom.
|
||||||
|
*/
|
||||||
|
public enum MappingsNamespace {
|
||||||
|
/**
|
||||||
|
* Official mappings are the names that are used in the vanilla Minecraft game jars, these are usually obfuscated.
|
||||||
|
*/
|
||||||
|
OFFICIAL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intermediary mappings have been generated to provide a stable set of names across minecraft versions.
|
||||||
|
*
|
||||||
|
* <p>Intermediary is used in a production runtime (outside a dev env) allowing mods to run across multiple versions of the game. Mods are remapped from "named" at build time.
|
||||||
|
*
|
||||||
|
* @see <a href="https://github.com/FabricMC/intermediary/">github.com/FabricMC/intermediary/</a>
|
||||||
|
*/
|
||||||
|
INTERMEDIARY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Named mappings are the developer friendly names used to develop mods against.
|
||||||
|
*/
|
||||||
|
NAMED;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name().toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 FabricMC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.fabricmc.loom.api.mappings.layered.spec;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.gradle.api.artifacts.Dependency;
|
||||||
|
import org.gradle.api.file.RegularFileProperty;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.configuration.providers.mappings.utils.DependencyFileSpec;
|
||||||
|
import net.fabricmc.loom.configuration.providers.mappings.utils.LocalFileSpec;
|
||||||
|
import net.fabricmc.loom.configuration.providers.mappings.utils.MavenFileSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileSpec should be used in MappingsSpec's that take an input file. The input file can either be a local file or a gradle dep.
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public interface FileSpec {
|
||||||
|
static FileSpec create(Object o) {
|
||||||
|
Objects.requireNonNull(o, "Object cannot be null");
|
||||||
|
|
||||||
|
if (o instanceof String s) {
|
||||||
|
return createFromMavenDependency(s);
|
||||||
|
} else if (o instanceof Dependency d) {
|
||||||
|
return createFromDependency(d);
|
||||||
|
} else if (o instanceof File f) {
|
||||||
|
return createFromFile(f);
|
||||||
|
} else if (o instanceof RegularFileProperty rfp) {
|
||||||
|
return createFromFile(rfp);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new UnsupportedOperationException("Cannot create FileSpec from object of type:" + o.getClass().getCanonicalName());
|
||||||
|
}
|
||||||
|
|
||||||
|
static FileSpec createFromMavenDependency(String dependencyNotation) {
|
||||||
|
return new MavenFileSpec(dependencyNotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FileSpec createFromDependency(Dependency dependency) {
|
||||||
|
return new DependencyFileSpec(dependency);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FileSpec createFromFile(File file) {
|
||||||
|
return new LocalFileSpec(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note resolved instantly, this is not lazy
|
||||||
|
static FileSpec createFromFile(RegularFileProperty regularFileProperty) {
|
||||||
|
return createFromFile(regularFileProperty.getAsFile().get());
|
||||||
|
}
|
||||||
|
|
||||||
|
Path get(MappingContext context);
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 FabricMC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.fabricmc.loom.api.mappings.layered.spec;
|
||||||
|
|
||||||
|
import org.gradle.api.Action;
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to configure a layered mapping spec.
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public interface LayeredMappingSpecBuilder {
|
||||||
|
/**
|
||||||
|
* Add a MappingsSpec layer.
|
||||||
|
*/
|
||||||
|
LayeredMappingSpecBuilder addLayer(MappingsSpec<?> mappingSpec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a layer that uses the official mappings provided by Mojang.
|
||||||
|
*/
|
||||||
|
LayeredMappingSpecBuilder officialMojangMappings();
|
||||||
|
|
||||||
|
default LayeredMappingSpecBuilder parchment(Object object) {
|
||||||
|
return parchment(object, parchmentMappingsSpecBuilder -> parchmentMappingsSpecBuilder.setRemovePrefix(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
LayeredMappingSpecBuilder parchment(Object object, Action<ParchmentMappingsSpecBuilder> action);
|
||||||
|
}
|
|
@ -22,8 +22,21 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings;
|
package net.fabricmc.loom.api.mappings.layered.spec;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingLayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A MappingsSpec is an immutable set of data used to create the MappingLayer.
|
||||||
|
*
|
||||||
|
* <p>The hashCode is used to generate a hash of the full layered mapping spec, used to cache.
|
||||||
|
*
|
||||||
|
* <p>Commonly implemented as a record
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
public interface MappingsSpec<L extends MappingLayer> {
|
public interface MappingsSpec<L extends MappingLayer> {
|
||||||
L createLayer(MappingContext context);
|
L createLayer(MappingContext context);
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2021 FabricMC
|
* Copyright (c) 2021 FabricMC
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,16 +22,14 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings;
|
package net.fabricmc.loom.api.mappings.layered.spec;
|
||||||
|
|
||||||
import java.util.Locale;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
public enum MappingNamespace {
|
@ApiStatus.Experimental
|
||||||
OFFICIAL,
|
public interface ParchmentMappingsSpecBuilder {
|
||||||
INTERMEDIARY,
|
/**
|
||||||
NAMED;
|
* When enabled the "p" prefix will be stripped from parameter names.
|
||||||
|
*/
|
||||||
public String stringValue() {
|
ParchmentMappingsSpecBuilder setRemovePrefix(boolean removePrefix);
|
||||||
return name().toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -54,6 +54,7 @@ import net.fabricmc.accesswidener.AccessWidenerRemapper;
|
||||||
import net.fabricmc.accesswidener.AccessWidenerVisitor;
|
import net.fabricmc.accesswidener.AccessWidenerVisitor;
|
||||||
import net.fabricmc.accesswidener.AccessWidenerWriter;
|
import net.fabricmc.accesswidener.AccessWidenerWriter;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
||||||
import net.fabricmc.loom.util.Checksum;
|
import net.fabricmc.loom.util.Checksum;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
|
@ -92,7 +93,7 @@ public class AccessWidenerJarProcessor implements JarProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remap accessWidener if its not named, allows for AE's to be written in intermediary
|
//Remap accessWidener if its not named, allows for AE's to be written in intermediary
|
||||||
if (!accessWidener.getNamespace().equals("named")) {
|
if (!accessWidener.getNamespace().equals(MappingsNamespace.NAMED.toString())) {
|
||||||
try {
|
try {
|
||||||
List<String> validNamespaces = loomGradleExtension.getMappingsProvider().getMappings().getMetadata().getNamespaces();
|
List<String> validNamespaces = loomGradleExtension.getMappingsProvider().getMappings().getMetadata().getNamespaces();
|
||||||
|
|
||||||
|
@ -100,10 +101,10 @@ public class AccessWidenerJarProcessor implements JarProcessor {
|
||||||
throw new UnsupportedOperationException(String.format("Access Widener namespace '%s' is not a valid namespace, it must be one of: '%s'", accessWidener.getNamespace(), String.join(", ", validNamespaces)));
|
throw new UnsupportedOperationException(String.format("Access Widener namespace '%s' is not a valid namespace, it must be one of: '%s'", accessWidener.getNamespace(), String.join(", ", validNamespaces)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TinyRemapper tinyRemapper = loomGradleExtension.getMinecraftMappedProvider().getTinyRemapper("official", "named");
|
TinyRemapper tinyRemapper = loomGradleExtension.getMinecraftMappedProvider().getTinyRemapper(MappingsNamespace.OFFICIAL.toString(), MappingsNamespace.NAMED.toString());
|
||||||
tinyRemapper.readClassPath(loomGradleExtension.getMinecraftMappedProvider().getRemapClasspath());
|
tinyRemapper.readClassPath(loomGradleExtension.getMinecraftMappedProvider().getRemapClasspath());
|
||||||
|
|
||||||
AccessWidenerRemapper remapper = new AccessWidenerRemapper(accessWidener, tinyRemapper.getRemapper(), "named");
|
AccessWidenerRemapper remapper = new AccessWidenerRemapper(accessWidener, tinyRemapper.getRemapper(), MappingsNamespace.NAMED.toString());
|
||||||
accessWidener = remapper.remap();
|
accessWidener = remapper.remap();
|
||||||
|
|
||||||
tinyRemapper.finish();
|
tinyRemapper.finish();
|
||||||
|
@ -160,7 +161,7 @@ public class AccessWidenerJarProcessor implements JarProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getRemappedAccessWidener(Remapper asmRemapper) throws IOException {
|
public byte[] getRemappedAccessWidener(Remapper asmRemapper) throws IOException {
|
||||||
AccessWidenerRemapper remapper = new AccessWidenerRemapper(accessWidener, asmRemapper, "intermediary");
|
AccessWidenerRemapper remapper = new AccessWidenerRemapper(accessWidener, asmRemapper, MappingsNamespace.INTERMEDIARY.toString());
|
||||||
AccessWidener remapped = remapper.remap();
|
AccessWidener remapped = remapper.remap();
|
||||||
AccessWidenerWriter accessWidenerWriter = new AccessWidenerWriter(remapped);
|
AccessWidenerWriter accessWidenerWriter = new AccessWidenerWriter(remapped);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ import net.fabricmc.accesswidener.AccessWidenerRemapper;
|
||||||
import net.fabricmc.accesswidener.AccessWidenerWriter;
|
import net.fabricmc.accesswidener.AccessWidenerWriter;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.LoomGradlePlugin;
|
import net.fabricmc.loom.LoomGradlePlugin;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
|
import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
|
||||||
import net.fabricmc.loom.configuration.processors.dependency.ModDependencyInfo;
|
import net.fabricmc.loom.configuration.processors.dependency.ModDependencyInfo;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
||||||
|
@ -113,7 +114,7 @@ public class ModProcessor {
|
||||||
AccessWidenerReader accessWidenerReader = new AccessWidenerReader(accessWidener);
|
AccessWidenerReader accessWidenerReader = new AccessWidenerReader(accessWidener);
|
||||||
accessWidenerReader.read(bufferedReader);
|
accessWidenerReader.read(bufferedReader);
|
||||||
|
|
||||||
AccessWidenerRemapper accessWidenerRemapper = new AccessWidenerRemapper(accessWidener, remapper, "named");
|
AccessWidenerRemapper accessWidenerRemapper = new AccessWidenerRemapper(accessWidener, remapper, MappingsNamespace.NAMED.toString());
|
||||||
AccessWidener remapped = accessWidenerRemapper.remap();
|
AccessWidener remapped = accessWidenerRemapper.remap();
|
||||||
AccessWidenerWriter accessWidenerWriter = new AccessWidenerWriter(remapped);
|
AccessWidenerWriter accessWidenerWriter = new AccessWidenerWriter(remapped);
|
||||||
|
|
||||||
|
@ -128,8 +129,8 @@ public class ModProcessor {
|
||||||
|
|
||||||
private static void remapJars(Project project, List<ModDependencyInfo> processList) throws IOException {
|
private static void remapJars(Project project, List<ModDependencyInfo> processList) throws IOException {
|
||||||
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
||||||
String fromM = "intermediary";
|
String fromM = MappingsNamespace.INTERMEDIARY.toString();
|
||||||
String toM = "named";
|
String toM = MappingsNamespace.NAMED.toString();
|
||||||
|
|
||||||
MinecraftMappedProvider mappedProvider = extension.getMinecraftMappedProvider();
|
MinecraftMappedProvider mappedProvider = extension.getMinecraftMappedProvider();
|
||||||
MappingsProviderImpl mappingsProvider = extension.getMappingsProvider();
|
MappingsProviderImpl mappingsProvider = extension.getMappingsProvider();
|
||||||
|
|
|
@ -25,12 +25,15 @@
|
||||||
package net.fabricmc.loom.configuration.providers.mappings;
|
package net.fabricmc.loom.configuration.providers.mappings;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
import org.gradle.api.artifacts.Configuration;
|
||||||
|
import org.gradle.api.artifacts.Dependency;
|
||||||
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.Logger;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProvider;
|
import net.fabricmc.loom.configuration.providers.MinecraftProvider;
|
||||||
|
|
||||||
public class GradleMappingContext implements MappingContext {
|
public class GradleMappingContext implements MappingContext {
|
||||||
|
@ -45,9 +48,14 @@ public class GradleMappingContext implements MappingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File mavenFile(String mavenNotation) {
|
public Path resolveDependency(Dependency dependency) {
|
||||||
Configuration configuration = project.getConfigurations().detachedConfiguration(project.getDependencies().create(mavenNotation));
|
Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
|
||||||
return configuration.getSingleFile();
|
return configuration.getSingleFile().toPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path resolveMavenDependency(String mavenNotation) {
|
||||||
|
return resolveDependency(project.getDependencies().create(mavenNotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,8 +69,8 @@ public class GradleMappingContext implements MappingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File workingDirectory(String name) {
|
public Path workingDirectory(String name) {
|
||||||
return new File(minecraftProvider().dir("layered/working_dir/" + workingDirName), name);
|
return new File(minecraftProvider().dir("layered/working_dir/" + workingDirName), name).toPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,8 @@ package net.fabricmc.loom.configuration.providers.mappings;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec;
|
||||||
|
|
||||||
public record LayeredMappingSpec(List<MappingsSpec<?>> layers) {
|
public record LayeredMappingSpec(List<MappingsSpec<?>> layers) {
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
// TODO something better?
|
// TODO something better?
|
||||||
|
|
|
@ -30,28 +30,33 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import org.gradle.api.Action;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.ParchmentMappingsSpecBuilder;
|
||||||
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.ParchmentMappingsSpecBuilderImpl;
|
||||||
|
|
||||||
public class LayeredMappingSpecBuilder {
|
public class LayeredMappingSpecBuilderImpl implements LayeredMappingSpecBuilder {
|
||||||
private final List<MappingsSpec<?>> layers = new LinkedList<>();
|
private final List<MappingsSpec<?>> layers = new LinkedList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LayeredMappingSpecBuilder addLayer(MappingsSpec<?> mappingSpec) {
|
||||||
|
layers.add(mappingSpec);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LayeredMappingSpecBuilder officialMojangMappings() {
|
public LayeredMappingSpecBuilder officialMojangMappings() {
|
||||||
layers.add(new MojangMappingsSpec());
|
return addLayer(new MojangMappingsSpec());
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayeredMappingSpecBuilder parchment(String mavenNotation) {
|
@Override
|
||||||
parchment(mavenNotation, parchmentMappingsSpecBuilder -> parchmentMappingsSpecBuilder.setRemovePrefix(true));
|
public LayeredMappingSpecBuilder parchment(Object object, Action<ParchmentMappingsSpecBuilder> action) {
|
||||||
return this;
|
ParchmentMappingsSpecBuilderImpl builder = ParchmentMappingsSpecBuilderImpl.builder(FileSpec.create(object));
|
||||||
}
|
|
||||||
|
|
||||||
public LayeredMappingSpecBuilder parchment(String mavenNotation, Action<ParchmentMappingsSpecBuilder> action) {
|
|
||||||
ParchmentMappingsSpecBuilder builder = ParchmentMappingsSpecBuilder.builder(mavenNotation);
|
|
||||||
action.execute(builder);
|
action.execute(builder);
|
||||||
layers.add(builder.build());
|
return addLayer(builder.build());
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayeredMappingSpec build() {
|
public LayeredMappingSpec build() {
|
|
@ -43,6 +43,8 @@ import org.zeroturnaround.zip.ZipEntrySource;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
import org.zeroturnaround.zip.ZipUtil;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradlePlugin;
|
import net.fabricmc.loom.LoomGradlePlugin;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.mappingio.adapter.MappingDstNsReorder;
|
import net.fabricmc.mappingio.adapter.MappingDstNsReorder;
|
||||||
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch;
|
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch;
|
||||||
import net.fabricmc.mappingio.format.Tiny2Writer;
|
import net.fabricmc.mappingio.format.Tiny2Writer;
|
||||||
|
@ -75,8 +77,8 @@ public class LayeredMappingsDependency implements SelfResolvingDependency {
|
||||||
try (Writer writer = new StringWriter()) {
|
try (Writer writer = new StringWriter()) {
|
||||||
Tiny2Writer tiny2Writer = new Tiny2Writer(writer, false);
|
Tiny2Writer tiny2Writer = new Tiny2Writer(writer, false);
|
||||||
|
|
||||||
MappingDstNsReorder nsReorder = new MappingDstNsReorder(tiny2Writer, Collections.singletonList(MappingNamespace.NAMED.stringValue()));
|
MappingDstNsReorder nsReorder = new MappingDstNsReorder(tiny2Writer, Collections.singletonList(MappingsNamespace.NAMED.toString()));
|
||||||
MappingSourceNsSwitch nsSwitch = new MappingSourceNsSwitch(nsReorder, MappingNamespace.INTERMEDIARY.stringValue(), true);
|
MappingSourceNsSwitch nsSwitch = new MappingSourceNsSwitch(nsReorder, MappingsNamespace.INTERMEDIARY.toString(), true);
|
||||||
mappings.accept(nsSwitch);
|
mappings.accept(nsSwitch);
|
||||||
|
|
||||||
Files.deleteIfExists(mappingsFile);
|
Files.deleteIfExists(mappingsFile);
|
||||||
|
|
|
@ -28,6 +28,10 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingLayer;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec;
|
||||||
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch;
|
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch;
|
||||||
import net.fabricmc.mappingio.tree.MemoryMappingTree;
|
import net.fabricmc.mappingio.tree.MemoryMappingTree;
|
||||||
|
|
||||||
|
@ -55,7 +59,7 @@ public class LayeredMappingsProcessor {
|
||||||
visitedLayers.add(layer.getClass());
|
visitedLayers.add(layer.getClass());
|
||||||
|
|
||||||
// We have to rebuild a new tree to work on when a layer doesnt merge into layered
|
// We have to rebuild a new tree to work on when a layer doesnt merge into layered
|
||||||
boolean rebuild = layer.getSourceNamespace() != MappingNamespace.NAMED;
|
boolean rebuild = layer.getSourceNamespace() != MappingsNamespace.NAMED;
|
||||||
MemoryMappingTree workingTree;
|
MemoryMappingTree workingTree;
|
||||||
|
|
||||||
if (rebuild) {
|
if (rebuild) {
|
||||||
|
@ -63,7 +67,7 @@ public class LayeredMappingsProcessor {
|
||||||
|
|
||||||
// This can be null on the first layer
|
// This can be null on the first layer
|
||||||
if (mappingTree.getSrcNamespace() != null) {
|
if (mappingTree.getSrcNamespace() != null) {
|
||||||
var sourceNsSwitch = new MappingSourceNsSwitch(tempTree, layer.getSourceNamespace().stringValue());
|
var sourceNsSwitch = new MappingSourceNsSwitch(tempTree, layer.getSourceNamespace().toString());
|
||||||
mappingTree.accept(sourceNsSwitch);
|
mappingTree.accept(sourceNsSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +84,7 @@ public class LayeredMappingsProcessor {
|
||||||
|
|
||||||
if (rebuild) {
|
if (rebuild) {
|
||||||
mappingTree = new MemoryMappingTree();
|
mappingTree = new MemoryMappingTree();
|
||||||
workingTree.accept(new MappingSourceNsSwitch(mappingTree, MappingNamespace.NAMED.stringValue()));
|
workingTree.accept(new MappingSourceNsSwitch(mappingTree, MappingsNamespace.NAMED.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.zeroturnaround.zip.ZipUtil;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.LoomGradlePlugin;
|
import net.fabricmc.loom.LoomGradlePlugin;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.configuration.DependencyProvider;
|
import net.fabricmc.loom.configuration.DependencyProvider;
|
||||||
import net.fabricmc.loom.configuration.accesswidener.AccessWidenerJarProcessor;
|
import net.fabricmc.loom.configuration.accesswidener.AccessWidenerJarProcessor;
|
||||||
import net.fabricmc.loom.configuration.processors.JarProcessorManager;
|
import net.fabricmc.loom.configuration.processors.JarProcessorManager;
|
||||||
|
@ -276,7 +277,7 @@ public class MappingsProviderImpl extends DependencyProvider implements Mappings
|
||||||
project.getLogger().info(":merging mappings");
|
project.getLogger().info(":merging mappings");
|
||||||
|
|
||||||
MemoryMappingTree tree = new MemoryMappingTree();
|
MemoryMappingTree tree = new MemoryMappingTree();
|
||||||
MappingSourceNsSwitch sourceNsSwitch = new MappingSourceNsSwitch(tree, MappingNamespace.OFFICIAL.stringValue());
|
MappingSourceNsSwitch sourceNsSwitch = new MappingSourceNsSwitch(tree, MappingsNamespace.OFFICIAL.toString());
|
||||||
readIntermediaryTree().accept(sourceNsSwitch);
|
readIntermediaryTree().accept(sourceNsSwitch);
|
||||||
|
|
||||||
try (BufferedReader reader = Files.newBufferedReader(from, StandardCharsets.UTF_8)) {
|
try (BufferedReader reader = Files.newBufferedReader(from, StandardCharsets.UTF_8)) {
|
||||||
|
@ -292,7 +293,7 @@ public class MappingsProviderImpl extends DependencyProvider implements Mappings
|
||||||
|
|
||||||
private MemoryMappingTree readIntermediaryTree() throws IOException {
|
private MemoryMappingTree readIntermediaryTree() throws IOException {
|
||||||
MemoryMappingTree tree = new MemoryMappingTree();
|
MemoryMappingTree tree = new MemoryMappingTree();
|
||||||
MappingNsCompleter nsCompleter = new MappingNsCompleter(tree, Collections.singletonMap(MappingNamespace.NAMED.stringValue(), MappingNamespace.INTERMEDIARY.stringValue()), true);
|
MappingNsCompleter nsCompleter = new MappingNsCompleter(tree, Collections.singletonMap(MappingsNamespace.NAMED.toString(), MappingsNamespace.INTERMEDIARY.toString()), true);
|
||||||
|
|
||||||
try (BufferedReader reader = Files.newBufferedReader(getIntermediaryTiny(), StandardCharsets.UTF_8)) {
|
try (BufferedReader reader = Files.newBufferedReader(getIntermediaryTiny(), StandardCharsets.UTF_8)) {
|
||||||
Tiny2Reader.read(reader, nsCompleter);
|
Tiny2Reader.read(reader, nsCompleter);
|
||||||
|
@ -316,7 +317,7 @@ public class MappingsProviderImpl extends DependencyProvider implements Mappings
|
||||||
runCommand(command, intermediaryMappings.toAbsolutePath().toString(),
|
runCommand(command, intermediaryMappings.toAbsolutePath().toString(),
|
||||||
yarnMappings.toAbsolutePath().toString(),
|
yarnMappings.toAbsolutePath().toString(),
|
||||||
newMergedMappings.toAbsolutePath().toString(),
|
newMergedMappings.toAbsolutePath().toString(),
|
||||||
"intermediary", "official");
|
MappingsNamespace.INTERMEDIARY.toString(), MappingsNamespace.OFFICIAL.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Could not merge mappings from " + intermediaryMappings.toString()
|
throw new RuntimeException("Could not merge mappings from " + intermediaryMappings.toString()
|
||||||
+ " with mappings from " + yarnMappings, e);
|
+ " with mappings from " + yarnMappings, e);
|
||||||
|
|
|
@ -31,22 +31,22 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingLayer;
|
import net.fabricmc.loom.api.mappings.layered.MappingLayer;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingNamespace;
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.mappingio.MappingVisitor;
|
import net.fabricmc.mappingio.MappingVisitor;
|
||||||
import net.fabricmc.mappingio.adapter.MappingNsCompleter;
|
import net.fabricmc.mappingio.adapter.MappingNsCompleter;
|
||||||
import net.fabricmc.mappingio.format.Tiny2Reader;
|
import net.fabricmc.mappingio.format.Tiny2Reader;
|
||||||
|
|
||||||
public record IntermediaryMappingLayer(File tinyFile) implements MappingLayer {
|
public record IntermediaryMappingLayer(File tinyFile) implements MappingLayer {
|
||||||
@Override
|
@Override
|
||||||
public MappingNamespace getSourceNamespace() {
|
public MappingsNamespace getSourceNamespace() {
|
||||||
return MappingNamespace.OFFICIAL;
|
return MappingsNamespace.OFFICIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(MappingVisitor mappingVisitor) throws IOException {
|
public void visit(MappingVisitor mappingVisitor) throws IOException {
|
||||||
// Populate named with intermediary and add Add a "named" namespace
|
// Populate named with intermediary and add Add a "named" namespace
|
||||||
MappingNsCompleter nsCompleter = new MappingNsCompleter(mappingVisitor, Collections.singletonMap(MappingNamespace.NAMED.stringValue(), MappingNamespace.INTERMEDIARY.stringValue()), true);
|
MappingNsCompleter nsCompleter = new MappingNsCompleter(mappingVisitor, Collections.singletonMap(MappingsNamespace.NAMED.toString(), MappingsNamespace.INTERMEDIARY.toString()), true);
|
||||||
|
|
||||||
try (BufferedReader reader = Files.newBufferedReader(tinyFile().toPath(), StandardCharsets.UTF_8)) {
|
try (BufferedReader reader = Files.newBufferedReader(tinyFile().toPath(), StandardCharsets.UTF_8)) {
|
||||||
Tiny2Reader.read(reader, nsCompleter);
|
Tiny2Reader.read(reader, nsCompleter);
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings.intermediary;
|
package net.fabricmc.loom.configuration.providers.mappings.intermediary;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingContext;
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec;
|
||||||
|
|
||||||
public record IntermediaryMappingsSpec() implements MappingsSpec<IntermediaryMappingLayer> {
|
public record IntermediaryMappingsSpec() implements MappingsSpec<IntermediaryMappingLayer> {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
package net.fabricmc.loom.configuration.providers.mappings.mojmap;
|
package net.fabricmc.loom.configuration.providers.mappings.mojmap;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
@ -35,8 +34,8 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.Logger;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingLayer;
|
import net.fabricmc.loom.api.mappings.layered.MappingLayer;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingNamespace;
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.intermediary.IntermediaryMappingLayer;
|
import net.fabricmc.loom.configuration.providers.mappings.intermediary.IntermediaryMappingLayer;
|
||||||
import net.fabricmc.loom.util.HashedDownloadUtil;
|
import net.fabricmc.loom.util.HashedDownloadUtil;
|
||||||
|
@ -46,30 +45,30 @@ import net.fabricmc.mappingio.format.ProGuardReader;
|
||||||
|
|
||||||
public record MojangMappingLayer(MinecraftVersionMeta.Download clientDownload,
|
public record MojangMappingLayer(MinecraftVersionMeta.Download clientDownload,
|
||||||
MinecraftVersionMeta.Download serverDownload,
|
MinecraftVersionMeta.Download serverDownload,
|
||||||
File workingDir,
|
Path workingDir,
|
||||||
Logger logger) implements MappingLayer {
|
Logger logger) implements MappingLayer {
|
||||||
@Override
|
@Override
|
||||||
public void visit(MappingVisitor mappingVisitor) throws IOException {
|
public void visit(MappingVisitor mappingVisitor) throws IOException {
|
||||||
var clientMappings = new File(workingDir(), "client.txt");
|
Path clientMappings = workingDir().resolve("client.txt");
|
||||||
var serverMappings = new File(workingDir(), "server.txt");
|
Path serverMappings = workingDir().resolve("server.txt");
|
||||||
|
|
||||||
download(clientMappings, serverMappings);
|
download(clientMappings, serverMappings);
|
||||||
|
|
||||||
printMappingsLicense(clientMappings.toPath());
|
printMappingsLicense(clientMappings);
|
||||||
|
|
||||||
// Make official the source namespace
|
// Make official the source namespace
|
||||||
MappingSourceNsSwitch nsSwitch = new MappingSourceNsSwitch(mappingVisitor, MappingNamespace.OFFICIAL.stringValue());
|
MappingSourceNsSwitch nsSwitch = new MappingSourceNsSwitch(mappingVisitor, MappingsNamespace.OFFICIAL.toString());
|
||||||
|
|
||||||
try (BufferedReader clientBufferedReader = Files.newBufferedReader(clientMappings.toPath(), StandardCharsets.UTF_8);
|
try (BufferedReader clientBufferedReader = Files.newBufferedReader(clientMappings, StandardCharsets.UTF_8);
|
||||||
BufferedReader serverBufferedReader = Files.newBufferedReader(serverMappings.toPath(), StandardCharsets.UTF_8)) {
|
BufferedReader serverBufferedReader = Files.newBufferedReader(serverMappings, StandardCharsets.UTF_8)) {
|
||||||
ProGuardReader.read(clientBufferedReader, MappingNamespace.NAMED.stringValue(), MappingNamespace.OFFICIAL.stringValue(), nsSwitch);
|
ProGuardReader.read(clientBufferedReader, MappingsNamespace.NAMED.toString(), MappingsNamespace.OFFICIAL.toString(), nsSwitch);
|
||||||
ProGuardReader.read(serverBufferedReader, MappingNamespace.NAMED.stringValue(), MappingNamespace.OFFICIAL.stringValue(), nsSwitch);
|
ProGuardReader.read(serverBufferedReader, MappingsNamespace.NAMED.toString(), MappingsNamespace.OFFICIAL.toString(), nsSwitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void download(File clientMappings, File serverMappings) throws IOException {
|
private void download(Path clientMappings, Path serverMappings) throws IOException {
|
||||||
HashedDownloadUtil.downloadIfInvalid(new URL(clientDownload().url()), clientMappings, clientDownload().sha1(), logger(), false);
|
HashedDownloadUtil.downloadIfInvalid(new URL(clientDownload().url()), clientMappings.toFile(), clientDownload().sha1(), logger(), false);
|
||||||
HashedDownloadUtil.downloadIfInvalid(new URL(serverDownload().url()), serverMappings, serverDownload().sha1(), logger(), false);
|
HashedDownloadUtil.downloadIfInvalid(new URL(serverDownload().url()), serverMappings.toFile(), serverDownload().sha1(), logger(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printMappingsLicense(Path clientMappings) {
|
private void printMappingsLicense(Path clientMappings) {
|
||||||
|
@ -91,8 +90,8 @@ public record MojangMappingLayer(MinecraftVersionMeta.Download clientDownload,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingNamespace getSourceNamespace() {
|
public MappingsNamespace getSourceNamespace() {
|
||||||
return MappingNamespace.OFFICIAL;
|
return MappingsNamespace.OFFICIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings.mojmap;
|
package net.fabricmc.loom.configuration.providers.mappings.mojmap;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingContext;
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec;
|
||||||
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
||||||
|
|
||||||
public record MojangMappingsSpec() implements MappingsSpec<MojangMappingLayer> {
|
public record MojangMappingsSpec() implements MappingsSpec<MojangMappingLayer> {
|
||||||
|
|
|
@ -24,19 +24,19 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings.parchment;
|
package net.fabricmc.loom.configuration.providers.mappings.parchment;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradlePlugin;
|
import net.fabricmc.loom.LoomGradlePlugin;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingLayer;
|
import net.fabricmc.loom.api.mappings.layered.MappingLayer;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingNamespace;
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.mappingio.MappingVisitor;
|
import net.fabricmc.mappingio.MappingVisitor;
|
||||||
|
|
||||||
public record ParchmentMappingLayer(File parchmentFile, boolean removePrefix) implements MappingLayer {
|
public record ParchmentMappingLayer(Path parchmentFile, boolean removePrefix) implements MappingLayer {
|
||||||
private static final String PARCHMENT_DATA_FILE_NAME = "parchment.json";
|
private static final String PARCHMENT_DATA_FILE_NAME = "parchment.json";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,11 +47,11 @@ public record ParchmentMappingLayer(File parchmentFile, boolean removePrefix) im
|
||||||
mappingVisitor = new ParchmentPrefixStripingMappingVisitor(mappingVisitor);
|
mappingVisitor = new ParchmentPrefixStripingMappingVisitor(mappingVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
parchmentData.visit(mappingVisitor, MappingNamespace.NAMED.stringValue());
|
parchmentData.visit(mappingVisitor, MappingsNamespace.NAMED.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParchmentTreeV1 getParchmentData() throws IOException {
|
private ParchmentTreeV1 getParchmentData() throws IOException {
|
||||||
try (var zipFile = new ZipFile(parchmentFile())) {
|
try (var zipFile = new ZipFile(parchmentFile().toFile())) {
|
||||||
ZipEntry zipFileEntry = zipFile.getEntry(PARCHMENT_DATA_FILE_NAME);
|
ZipEntry zipFileEntry = zipFile.getEntry(PARCHMENT_DATA_FILE_NAME);
|
||||||
Objects.requireNonNull(zipFileEntry, "Could not find %s in parchment data file".formatted(PARCHMENT_DATA_FILE_NAME));
|
Objects.requireNonNull(zipFileEntry, "Could not find %s in parchment data file".formatted(PARCHMENT_DATA_FILE_NAME));
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,13 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings.parchment;
|
package net.fabricmc.loom.configuration.providers.mappings.parchment;
|
||||||
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingContext;
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec;
|
||||||
|
|
||||||
public record ParchmentMappingsSpec(String mavenNotation, boolean removePrefix) implements MappingsSpec<ParchmentMappingLayer> {
|
public record ParchmentMappingsSpec(FileSpec fileSpec, boolean removePrefix) implements MappingsSpec<ParchmentMappingLayer> {
|
||||||
@Override
|
@Override
|
||||||
public ParchmentMappingLayer createLayer(MappingContext context) {
|
public ParchmentMappingLayer createLayer(MappingContext context) {
|
||||||
return new ParchmentMappingLayer(context.mavenFile(mavenNotation()), removePrefix());
|
return new ParchmentMappingLayer(fileSpec.get(context), removePrefix());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,25 +24,29 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration.providers.mappings.parchment;
|
package net.fabricmc.loom.configuration.providers.mappings.parchment;
|
||||||
|
|
||||||
public class ParchmentMappingsSpecBuilder {
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec;
|
||||||
private final String mavenNotation;
|
import net.fabricmc.loom.api.mappings.layered.spec.ParchmentMappingsSpecBuilder;
|
||||||
|
|
||||||
|
public class ParchmentMappingsSpecBuilderImpl implements ParchmentMappingsSpecBuilder {
|
||||||
|
private final FileSpec fileSpec;
|
||||||
|
|
||||||
private boolean removePrefix;
|
private boolean removePrefix;
|
||||||
|
|
||||||
private ParchmentMappingsSpecBuilder(String mavenNotation) {
|
private ParchmentMappingsSpecBuilderImpl(FileSpec fileSpec) {
|
||||||
this.mavenNotation = mavenNotation;
|
this.fileSpec = fileSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParchmentMappingsSpecBuilder builder(String depNotation) {
|
public static ParchmentMappingsSpecBuilderImpl builder(FileSpec fileSpec) {
|
||||||
return new ParchmentMappingsSpecBuilder(depNotation);
|
return new ParchmentMappingsSpecBuilderImpl(fileSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ParchmentMappingsSpecBuilder setRemovePrefix(boolean removePrefix) {
|
public ParchmentMappingsSpecBuilder setRemovePrefix(boolean removePrefix) {
|
||||||
this.removePrefix = removePrefix;
|
this.removePrefix = removePrefix;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParchmentMappingsSpec build() {
|
public ParchmentMappingsSpec build() {
|
||||||
return new ParchmentMappingsSpec(mavenNotation, removePrefix);
|
return new ParchmentMappingsSpec(fileSpec, removePrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 FabricMC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.fabricmc.loom.configuration.providers.mappings.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.gradle.api.artifacts.Dependency;
|
||||||
|
import org.gradle.api.artifacts.SelfResolvingDependency;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec;
|
||||||
|
|
||||||
|
public record DependencyFileSpec(Dependency dependency) implements FileSpec {
|
||||||
|
@Override
|
||||||
|
public Path get(MappingContext context) {
|
||||||
|
if (dependency instanceof SelfResolvingDependency selfResolvingDependency) {
|
||||||
|
Set<File> files = selfResolvingDependency.resolve();
|
||||||
|
|
||||||
|
if (files.size() == 0) {
|
||||||
|
throw new RuntimeException("SelfResolvingDependency (%s) resolved no files".formatted(selfResolvingDependency.toString()));
|
||||||
|
} else if (files.size() > 1) {
|
||||||
|
throw new RuntimeException("SelfResolvingDependency (%s) resolved too many files (%d) only 1 is expected".formatted(selfResolvingDependency.toString(), files.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return files.iterator().next().toPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.resolveDependency(dependency);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(dependency.getGroup(), dependency.getName(), dependency.getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof DependencyFileSpec other) {
|
||||||
|
return other.dependency().contentEquals(this.dependency());
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 FabricMC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.fabricmc.loom.configuration.providers.mappings.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
import net.fabricmc.loom.util.Checksum;
|
||||||
|
|
||||||
|
public class LocalFileSpec implements FileSpec {
|
||||||
|
private final File file;
|
||||||
|
private final int hash;
|
||||||
|
|
||||||
|
public LocalFileSpec(File file) {
|
||||||
|
this.file = file;
|
||||||
|
this.hash = calculateHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int calculateHashCode() {
|
||||||
|
if (!file.exists()) {
|
||||||
|
throw new RuntimeException("Could not find %s, it must be present at spec creation time to calculate mappings hash".formatted(file.getAbsolutePath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the file hash as part of the spec, this means if the input file changes the mappings will be re-generated.
|
||||||
|
return Objects.hash(Arrays.hashCode(Checksum.sha256(file)), file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path get(MappingContext context) {
|
||||||
|
return file.toPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 FabricMC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.fabricmc.loom.configuration.providers.mappings.utils;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingContext;
|
||||||
|
|
||||||
|
public record MavenFileSpec(String dependencyNotation) implements FileSpec {
|
||||||
|
@Override
|
||||||
|
public Path get(MappingContext context) {
|
||||||
|
return context.resolveMavenDependency(dependencyNotation);
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ import java.util.function.Consumer;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.configuration.DependencyProvider;
|
import net.fabricmc.loom.configuration.DependencyProvider;
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProviderImpl;
|
import net.fabricmc.loom.configuration.providers.MinecraftProviderImpl;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
||||||
|
@ -99,7 +100,7 @@ public class MinecraftMappedProvider extends DependencyProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mapMinecraftJar() throws IOException {
|
private void mapMinecraftJar() throws IOException {
|
||||||
String fromM = "official";
|
String fromM = MappingsNamespace.OFFICIAL.toString();
|
||||||
|
|
||||||
MappingsProviderImpl mappingsProvider = getExtension().getMappingsProvider();
|
MappingsProviderImpl mappingsProvider = getExtension().getMappingsProvider();
|
||||||
|
|
||||||
|
@ -107,8 +108,8 @@ public class MinecraftMappedProvider extends DependencyProvider {
|
||||||
Path outputMapped = minecraftMappedJar.toPath();
|
Path outputMapped = minecraftMappedJar.toPath();
|
||||||
Path outputIntermediary = minecraftIntermediaryJar.toPath();
|
Path outputIntermediary = minecraftIntermediaryJar.toPath();
|
||||||
|
|
||||||
for (String toM : Arrays.asList("named", "intermediary")) {
|
for (String toM : Arrays.asList(MappingsNamespace.NAMED.toString(), MappingsNamespace.INTERMEDIARY.toString())) {
|
||||||
Path output = "named".equals(toM) ? outputMapped : outputIntermediary;
|
Path output = MappingsNamespace.NAMED.toString().equals(toM) ? outputMapped : outputIntermediary;
|
||||||
|
|
||||||
getProject().getLogger().lifecycle(":remapping minecraft (TinyRemapper, " + fromM + " -> " + toM + ")");
|
getProject().getLogger().lifecycle(":remapping minecraft (TinyRemapper, " + fromM + " -> " + toM + ")");
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,13 @@ import org.gradle.api.publish.maven.MavenPublication;
|
||||||
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
||||||
import net.fabricmc.loom.api.MixinExtensionAPI;
|
import net.fabricmc.loom.api.MixinExtensionAPI;
|
||||||
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
|
||||||
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
||||||
import net.fabricmc.loom.configuration.mods.ModVersionParser;
|
import net.fabricmc.loom.configuration.mods.ModVersionParser;
|
||||||
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
||||||
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.LayeredMappingSpecBuilderImpl;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsDependency;
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsDependency;
|
||||||
import net.fabricmc.loom.util.DeprecationHelper;
|
import net.fabricmc.loom.util.DeprecationHelper;
|
||||||
|
|
||||||
|
@ -113,7 +114,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();
|
LayeredMappingSpecBuilderImpl builder = new LayeredMappingSpecBuilderImpl();
|
||||||
action.execute(builder);
|
action.execute(builder);
|
||||||
LayeredMappingSpec builtSpec = builder.build();
|
LayeredMappingSpec builtSpec = builder.build();
|
||||||
return new LayeredMappingsDependency(new GradleMappingContext(getProject(), builtSpec.getVersion().replace("+", "_").replace(".", "_")), builtSpec, builtSpec.getVersion());
|
return new LayeredMappingsDependency(new GradleMappingContext(getProject(), builtSpec.getVersion().replace("+", "_").replace(".", "_")), builtSpec, builtSpec.getVersion());
|
||||||
|
|
|
@ -36,9 +36,9 @@ import org.gradle.api.publish.maven.MavenPublication;
|
||||||
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
||||||
import net.fabricmc.loom.api.MixinExtensionAPI;
|
import net.fabricmc.loom.api.MixinExtensionAPI;
|
||||||
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
|
||||||
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.mappings.LayeredMappingSpecBuilder;
|
|
||||||
import net.fabricmc.loom.util.DeprecationHelper;
|
import net.fabricmc.loom.util.DeprecationHelper;
|
||||||
|
|
||||||
public class MinecraftGradleExtension implements LoomGradleExtensionAPI {
|
public class MinecraftGradleExtension implements LoomGradleExtensionAPI {
|
||||||
|
|
|
@ -49,10 +49,11 @@ import org.gradle.api.tasks.TaskAction;
|
||||||
import org.gradle.api.tasks.options.Option;
|
import org.gradle.api.tasks.options.Option;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsDependency;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
||||||
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftMappedProvider;
|
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftMappedProvider;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpecBuilder;
|
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsDependency;
|
|
||||||
import net.fabricmc.loom.util.SourceRemapper;
|
import net.fabricmc.loom.util.SourceRemapper;
|
||||||
import net.fabricmc.lorenztiny.TinyMappingsJoiner;
|
import net.fabricmc.lorenztiny.TinyMappingsJoiner;
|
||||||
import net.fabricmc.mapping.tree.TinyMappingFactory;
|
import net.fabricmc.mapping.tree.TinyMappingFactory;
|
||||||
|
@ -166,9 +167,9 @@ public class MigrateMappingsTask extends AbstractLoomTask {
|
||||||
project.getLogger().info(":joining mappings");
|
project.getLogger().info(":joining mappings");
|
||||||
|
|
||||||
MappingSet mappingSet = new TinyMappingsJoiner(
|
MappingSet mappingSet = new TinyMappingsJoiner(
|
||||||
currentMappings, "named",
|
currentMappings, MappingsNamespace.NAMED.toString(),
|
||||||
targetMappings, "named",
|
targetMappings, MappingsNamespace.NAMED.toString(),
|
||||||
"intermediary"
|
MappingsNamespace.INTERMEDIARY.toString()
|
||||||
).read();
|
).read();
|
||||||
|
|
||||||
project.getLogger().lifecycle(":remapping");
|
project.getLogger().lifecycle(":remapping");
|
||||||
|
|
|
@ -57,6 +57,7 @@ import org.zeroturnaround.zip.transform.StreamZipEntryTransformer;
|
||||||
import org.zeroturnaround.zip.transform.ZipEntryTransformerEntry;
|
import org.zeroturnaround.zip.transform.ZipEntryTransformerEntry;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.build.JarRemapper;
|
import net.fabricmc.loom.build.JarRemapper;
|
||||||
import net.fabricmc.loom.build.MixinRefmapHelper;
|
import net.fabricmc.loom.build.MixinRefmapHelper;
|
||||||
import net.fabricmc.loom.build.nesting.JarNester;
|
import net.fabricmc.loom.build.nesting.JarNester;
|
||||||
|
@ -130,8 +131,8 @@ public class RemapJarTask extends Jar {
|
||||||
|
|
||||||
MappingsProviderImpl mappingsProvider = extension.getMappingsProvider();
|
MappingsProviderImpl mappingsProvider = extension.getMappingsProvider();
|
||||||
|
|
||||||
String fromM = "named";
|
String fromM = MappingsNamespace.NAMED.toString();
|
||||||
String toM = "intermediary";
|
String toM = MappingsNamespace.INTERMEDIARY.toString();
|
||||||
|
|
||||||
if (isMainRemapTask) {
|
if (isMainRemapTask) {
|
||||||
jarRemapper.addToClasspath(getRemapClasspath());
|
jarRemapper.addToClasspath(getRemapClasspath());
|
||||||
|
|
|
@ -32,12 +32,13 @@ import org.gradle.api.tasks.Internal;
|
||||||
import org.gradle.api.tasks.OutputFile;
|
import org.gradle.api.tasks.OutputFile;
|
||||||
import org.gradle.api.tasks.TaskAction;
|
import org.gradle.api.tasks.TaskAction;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.util.SourceRemapper;
|
import net.fabricmc.loom.util.SourceRemapper;
|
||||||
|
|
||||||
public class RemapSourcesJarTask extends AbstractLoomTask {
|
public class RemapSourcesJarTask extends AbstractLoomTask {
|
||||||
private final RegularFileProperty input = getProject().getObjects().fileProperty();
|
private final RegularFileProperty input = getProject().getObjects().fileProperty();
|
||||||
private final RegularFileProperty output = getProject().getObjects().fileProperty().convention(input);
|
private final RegularFileProperty output = getProject().getObjects().fileProperty().convention(input);
|
||||||
private final Property<String> targetNamespace = getProject().getObjects().property(String.class).convention("intermediary");
|
private final Property<String> targetNamespace = getProject().getObjects().property(String.class).convention(MappingsNamespace.INTERMEDIARY.toString());
|
||||||
private SourceRemapper sourceRemapper = null;
|
private SourceRemapper sourceRemapper = null;
|
||||||
private final Property<Boolean> preserveFileTimestamps = getProject().getObjects().property(Boolean.class).convention(true);
|
private final Property<Boolean> preserveFileTimestamps = getProject().getObjects().property(Boolean.class).convention(true);
|
||||||
private final Property<Boolean> reproducibleFileOrder = getProject().getObjects().property(Boolean.class).convention(false);
|
private final Property<Boolean> reproducibleFileOrder = getProject().getObjects().property(Boolean.class).convention(false);
|
||||||
|
@ -49,7 +50,7 @@ public class RemapSourcesJarTask extends AbstractLoomTask {
|
||||||
public void remap() throws Exception {
|
public void remap() throws Exception {
|
||||||
if (sourceRemapper == null) {
|
if (sourceRemapper == null) {
|
||||||
String direction = targetNamespace.get();
|
String direction = targetNamespace.get();
|
||||||
SourceRemapper.remapSources(getProject(), input.get().getAsFile(), output.get().getAsFile(), direction.equals("named"), reproducibleFileOrder.get(), preserveFileTimestamps.get());
|
SourceRemapper.remapSources(getProject(), input.get().getAsFile(), output.get().getAsFile(), direction.equals(MappingsNamespace.NAMED.toString()), reproducibleFileOrder.get(), preserveFileTimestamps.get());
|
||||||
} else {
|
} else {
|
||||||
sourceRemapper.scheduleRemapSources(input.get().getAsFile(), output.get().getAsFile(), reproducibleFileOrder.get(), preserveFileTimestamps.get());
|
sourceRemapper.scheduleRemapSources(input.get().getAsFile(), output.get().getAsFile(), reproducibleFileOrder.get(), preserveFileTimestamps.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.gradle.api.Project;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
import org.zeroturnaround.zip.ZipUtil;
|
||||||
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
|
||||||
import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
|
import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
||||||
import net.fabricmc.loom.util.gradle.ProgressLogger;
|
import net.fabricmc.loom.util.gradle.ProgressLogger;
|
||||||
|
@ -166,7 +167,7 @@ public class SourceRemapper {
|
||||||
try {
|
try {
|
||||||
TinyTree m = mappingsProvider.getMappings();
|
TinyTree m = mappingsProvider.getMappings();
|
||||||
project.getLogger().info(":loading " + (toNamed ? "intermediary -> named" : "named -> intermediary") + " source mappings");
|
project.getLogger().info(":loading " + (toNamed ? "intermediary -> named" : "named -> intermediary") + " source mappings");
|
||||||
return new TinyMappingsReader(m, toNamed ? "intermediary" : "named", toNamed ? "named" : "intermediary").read();
|
return new TinyMappingsReader(m, toNamed ? MappingsNamespace.INTERMEDIARY.toString() : MappingsNamespace.NAMED.toString(), toNamed ? MappingsNamespace.NAMED.toString() : MappingsNamespace.INTERMEDIARY.toString()).read();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.test.unit.layeredmappings
|
package net.fabricmc.loom.test.unit.layeredmappings
|
||||||
|
|
||||||
|
import net.fabricmc.loom.configuration.providers.mappings.utils.MavenFileSpec
|
||||||
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.LayeredMappingSpecBuilderImpl
|
||||||
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.ParchmentMappingsSpec
|
import net.fabricmc.loom.configuration.providers.mappings.parchment.ParchmentMappingsSpec
|
||||||
|
@ -61,7 +62,7 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
layers[2].class == ParchmentMappingsSpec
|
layers[2].class == ParchmentMappingsSpec
|
||||||
parchment.mavenNotation() == "I like cake"
|
(parchment.fileSpec() as MavenFileSpec).dependencyNotation() == "I like cake"
|
||||||
parchment.removePrefix() == true
|
parchment.removePrefix() == true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
layers[2].class == ParchmentMappingsSpec
|
layers[2].class == ParchmentMappingsSpec
|
||||||
parchment.mavenNotation() == "I like cake"
|
(parchment.fileSpec() as MavenFileSpec).dependencyNotation() == "I like cake"
|
||||||
parchment.removePrefix() == false
|
parchment.removePrefix() == false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,17 +102,17 @@ class LayeredMappingSpecBuilderTest extends Specification {
|
||||||
layers[0].class == IntermediaryMappingsSpec
|
layers[0].class == IntermediaryMappingsSpec
|
||||||
layers[1].class == MojangMappingsSpec
|
layers[1].class == MojangMappingsSpec
|
||||||
layers[2].class == ParchmentMappingsSpec
|
layers[2].class == ParchmentMappingsSpec
|
||||||
parchment.mavenNotation() == "I really like cake"
|
(parchment.fileSpec() as MavenFileSpec).dependencyNotation() == "I really like cake"
|
||||||
parchment.removePrefix() == false
|
parchment.removePrefix() == false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gradle does this big of magic behind the scenes
|
// Gradle does this big of magic behind the scenes
|
||||||
LayeredMappingSpec layered(@DelegatesTo(LayeredMappingSpecBuilder) Closure cl) {
|
LayeredMappingSpec layered(@DelegatesTo(LayeredMappingSpecBuilderImpl) Closure cl) {
|
||||||
return layeredAction(ConfigureUtil.configureUsing(cl))
|
return layeredAction(ConfigureUtil.configureUsing(cl))
|
||||||
}
|
}
|
||||||
|
|
||||||
LayeredMappingSpec layeredAction(Action<LayeredMappingSpecBuilder> action) {
|
LayeredMappingSpec layeredAction(Action<LayeredMappingSpecBuilderImpl> action) {
|
||||||
LayeredMappingSpecBuilder builder = new LayeredMappingSpecBuilder()
|
LayeredMappingSpecBuilderImpl builder = new LayeredMappingSpecBuilderImpl()
|
||||||
action.execute(builder)
|
action.execute(builder)
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,18 +28,20 @@ import groovy.transform.CompileStatic
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProvider
|
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.LayeredMappingsProcessor
|
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsProcessor
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingContext
|
import net.fabricmc.loom.api.mappings.layered.MappingContext
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingLayer
|
import net.fabricmc.loom.api.mappings.layered.MappingLayer
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingNamespace
|
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProvider
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProvider
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec
|
import net.fabricmc.loom.api.mappings.layered.spec.MappingsSpec
|
||||||
import net.fabricmc.mappingio.adapter.MappingDstNsReorder
|
import net.fabricmc.mappingio.adapter.MappingDstNsReorder
|
||||||
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch
|
import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch
|
||||||
import net.fabricmc.mappingio.format.Tiny2Writer
|
import net.fabricmc.mappingio.format.Tiny2Writer
|
||||||
import net.fabricmc.mappingio.tree.MemoryMappingTree
|
import net.fabricmc.mappingio.tree.MemoryMappingTree
|
||||||
|
import org.gradle.api.artifacts.Dependency
|
||||||
import org.gradle.api.logging.Logger
|
import org.gradle.api.logging.Logger
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
|
import java.nio.file.Path
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
|
|
||||||
abstract class LayeredMappingsSpecification extends Specification implements LayeredMappingsTestConstants {
|
abstract class LayeredMappingsSpecification extends Specification implements LayeredMappingsTestConstants {
|
||||||
|
@ -94,8 +96,8 @@ abstract class LayeredMappingsSpecification extends Specification implements Lay
|
||||||
|
|
||||||
MemoryMappingTree reorder(MemoryMappingTree mappingTree) {
|
MemoryMappingTree reorder(MemoryMappingTree mappingTree) {
|
||||||
def reorderedMappings = new MemoryMappingTree()
|
def reorderedMappings = new MemoryMappingTree()
|
||||||
def nsReorder = new MappingDstNsReorder(reorderedMappings, Collections.singletonList(MappingNamespace.NAMED.stringValue()))
|
def nsReorder = new MappingDstNsReorder(reorderedMappings, Collections.singletonList(MappingsNamespace.NAMED.toString()))
|
||||||
def nsSwitch = new MappingSourceNsSwitch(nsReorder, MappingNamespace.INTERMEDIARY.stringValue(), true)
|
def nsSwitch = new MappingSourceNsSwitch(nsReorder, MappingsNamespace.INTERMEDIARY.toString(), true)
|
||||||
mappingTree.accept(nsSwitch)
|
mappingTree.accept(nsSwitch)
|
||||||
return reorderedMappings
|
return reorderedMappings
|
||||||
}
|
}
|
||||||
|
@ -103,9 +105,14 @@ abstract class LayeredMappingsSpecification extends Specification implements Lay
|
||||||
@CompileStatic
|
@CompileStatic
|
||||||
class TestMappingContext implements MappingContext {
|
class TestMappingContext implements MappingContext {
|
||||||
@Override
|
@Override
|
||||||
File mavenFile(String mavenNotation) {
|
Path resolveDependency(Dependency dependency) {
|
||||||
|
throw new UnsupportedOperationException("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
Path resolveMavenDependency(String mavenNotation) {
|
||||||
assert mavenFiles.containsKey(mavenNotation)
|
assert mavenFiles.containsKey(mavenNotation)
|
||||||
return mavenFiles.get(mavenNotation)
|
return mavenFiles.get(mavenNotation).toPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,8 +126,8 @@ abstract class LayeredMappingsSpecification extends Specification implements Lay
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
File workingDirectory(String name) {
|
Path workingDirectory(String name) {
|
||||||
return new File(tempDir, name)
|
return new File(tempDir, name).toPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.test.unit.layeredmappings
|
package net.fabricmc.loom.test.unit.layeredmappings
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.mappings.layered.spec.FileSpec
|
||||||
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.ParchmentMappingsSpec
|
import net.fabricmc.loom.configuration.providers.mappings.parchment.ParchmentMappingsSpec
|
||||||
|
@ -38,7 +39,7 @@ class ParchmentMappingLayerTest extends LayeredMappingsSpecification {
|
||||||
def mappings = getLayeredMappings(
|
def mappings = getLayeredMappings(
|
||||||
new IntermediaryMappingsSpec(),
|
new IntermediaryMappingsSpec(),
|
||||||
new MojangMappingsSpec(),
|
new MojangMappingsSpec(),
|
||||||
new ParchmentMappingsSpec(PARCHMENT_NOTATION, false)
|
new ParchmentMappingsSpec(FileSpec.create(PARCHMENT_NOTATION), false)
|
||||||
)
|
)
|
||||||
def tiny = getTiny(mappings)
|
def tiny = getTiny(mappings)
|
||||||
def reorderedMappings = reorder(mappings)
|
def reorderedMappings = reorder(mappings)
|
||||||
|
@ -61,7 +62,7 @@ class ParchmentMappingLayerTest extends LayeredMappingsSpecification {
|
||||||
def mappings = getLayeredMappings(
|
def mappings = getLayeredMappings(
|
||||||
new IntermediaryMappingsSpec(),
|
new IntermediaryMappingsSpec(),
|
||||||
new MojangMappingsSpec(),
|
new MojangMappingsSpec(),
|
||||||
new ParchmentMappingsSpec(PARCHMENT_NOTATION, true)
|
new ParchmentMappingsSpec(FileSpec.create(PARCHMENT_NOTATION), true)
|
||||||
)
|
)
|
||||||
def tiny = getTiny(mappings)
|
def tiny = getTiny(mappings)
|
||||||
def reorderedMappings = reorder(mappings)
|
def reorderedMappings = reorder(mappings)
|
||||||
|
|
Loading…
Reference in New Issue