chore: updated to mapping library 0.3.0

This commit is contained in:
zaaarf 2023-09-01 12:42:19 +02:00
parent 30f8e080ae
commit 3dd86a4187
No known key found for this signature in database
GPG key ID: 6445A5CD15E5B40C
3 changed files with 13 additions and 15 deletions

View file

@ -7,8 +7,7 @@ archivesBaseName = 'processor'
version = gitVersion() version = gitVersion()
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = targetCompatibility JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar() withSourcesJar()
withJavadocJar() withJavadocJar()
} }
@ -22,7 +21,7 @@ dependencies {
implementation 'com.squareup:javapoet:1.13.0' implementation 'com.squareup:javapoet:1.13.0'
implementation 'org.ow2.asm:asm-commons:9.5' implementation 'org.ow2.asm:asm-commons:9.5'
implementation 'ftbsc:lll:0.4.2' implementation 'ftbsc:lll:0.4.2'
implementation 'ftbsc.lll:mapper:0.2.0' implementation 'ftbsc.lll:mapper:0.3.0'
} }
jar { jar {

View file

@ -4,12 +4,12 @@ import ftbsc.lll.exceptions.AmbiguousDefinitionException;
import ftbsc.lll.exceptions.MappingNotFoundException; import ftbsc.lll.exceptions.MappingNotFoundException;
import ftbsc.lll.exceptions.NotAProxyException; import ftbsc.lll.exceptions.NotAProxyException;
import ftbsc.lll.exceptions.TargetNotFoundException; import ftbsc.lll.exceptions.TargetNotFoundException;
import ftbsc.lll.mapper.tools.Mapper;
import ftbsc.lll.mapper.tools.data.ClassData; import ftbsc.lll.mapper.tools.data.ClassData;
import ftbsc.lll.mapper.tools.data.FieldData; import ftbsc.lll.mapper.tools.data.FieldData;
import ftbsc.lll.mapper.tools.data.MethodData; import ftbsc.lll.mapper.tools.data.MethodData;
import ftbsc.lll.processor.annotations.Target; import ftbsc.lll.processor.annotations.Target;
import ftbsc.lll.processor.tools.containers.ClassContainer; import ftbsc.lll.processor.tools.containers.ClassContainer;
import ftbsc.lll.mapper.IMapper;
import ftbsc.lll.proxies.ProxyType; import ftbsc.lll.proxies.ProxyType;
import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.ProcessingEnvironment;
@ -216,11 +216,11 @@ public class ASTUtils {
* Gets the {@link ClassData} corresponding to the given fully-qualified name, * Gets the {@link ClassData} corresponding to the given fully-qualified name,
* or creates a false one with the same, non-obfuscated name twice. * or creates a false one with the same, non-obfuscated name twice.
* @param name the internal name of the class to convert * @param name the internal name of the class to convert
* @param mapper the {@link IMapper} to use, may be null * @param mapper the {@link Mapper} to use, may be null
* @return the fully qualified class name * @return the fully qualified class name
* @since 0.6.1 * @since 0.6.1
*/ */
public static ClassData getClassData(String name, IMapper mapper) { public static ClassData getClassData(String name, Mapper mapper) {
try { try {
name = name.replace('.', '/'); //just in case name = name.replace('.', '/'); //just in case
if(mapper != null) if(mapper != null)
@ -236,11 +236,11 @@ public class ASTUtils {
* @param parent the internal name of the parent class * @param parent the internal name of the parent class
* @param name the name of the member * @param name the name of the member
* @param descriptor the descriptor of the method * @param descriptor the descriptor of the method
* @param mapper the {@link IMapper} to use, may be null * @param mapper the {@link Mapper} to use, may be null
* @return the fully qualified class name * @return the fully qualified class name
* @since 0.6.1 * @since 0.6.1
*/ */
public static MethodData getMethodData(String parent, String name, String descriptor, IMapper mapper) { public static MethodData getMethodData(String parent, String name, String descriptor, Mapper mapper) {
try { try {
name = name.replace('.', '/'); //just in case name = name.replace('.', '/'); //just in case
if(mapper != null) if(mapper != null)
@ -255,11 +255,11 @@ public class ASTUtils {
* mapping is found. * mapping is found.
* @param parent the internal name of the parent class * @param parent the internal name of the parent class
* @param name the name of the member * @param name the name of the member
* @param mapper the {@link IMapper} to use, may be null * @param mapper the {@link Mapper} to use, may be null
* @return the fully qualified class name * @return the fully qualified class name
* @since 0.6.1 * @since 0.6.1
*/ */
public static FieldData getFieldData(String parent, String name, IMapper mapper) { public static FieldData getFieldData(String parent, String name, Mapper mapper) {
try { try {
name = name.replace('.', '/'); //just in case name = name.replace('.', '/'); //just in case
if(mapper != null) if(mapper != null)

View file

@ -1,8 +1,8 @@
package ftbsc.lll.processor.tools; package ftbsc.lll.processor.tools;
import ftbsc.lll.IInjector; import ftbsc.lll.IInjector;
import ftbsc.lll.mapper.IMapper;
import ftbsc.lll.mapper.MapperProvider; import ftbsc.lll.mapper.MapperProvider;
import ftbsc.lll.mapper.tools.Mapper;
import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.ProcessingEnvironment;
import java.util.Arrays; import java.util.Arrays;
@ -30,10 +30,10 @@ public class ProcessorOptions {
public final ProcessingEnvironment env; public final ProcessingEnvironment env;
/** /**
* The {@link IMapper} used to convert classes and variables * The {@link Mapper} used to convert classes and variables
* to their obfuscated equivalent. Will be null when no mapper is in use. * to their obfuscated equivalent. Will be null when no mapper is in use.
*/ */
public final IMapper mapper; public final Mapper mapper;
/** /**
* Whether the processor should issue warnings when compiling code anonymous * Whether the processor should issue warnings when compiling code anonymous
@ -61,8 +61,7 @@ public class ProcessorOptions {
String location = env.getOptions().get("mappingsFile"); String location = env.getOptions().get("mappingsFile");
if(location != null) { if(location != null) {
List<String> lines = MapperProvider.fetchFromLocalOrRemote(location); List<String> lines = MapperProvider.fetchFromLocalOrRemote(location);
this.mapper = MapperProvider.getMapper(lines); this.mapper = MapperProvider.getMapper(lines).getMapper(lines, true);
this.mapper.populate(lines, true);
} else this.mapper = null; } else this.mapper = null;
this.anonymousClassWarning = parseBooleanArg(env.getOptions().get("anonymousClassWarning"), true); this.anonymousClassWarning = parseBooleanArg(env.getOptions().get("anonymousClassWarning"), true);
this.obfuscateInjectorMetadata = parseBooleanArg(env.getOptions().get("obfuscateInjectorMetadata"), true); this.obfuscateInjectorMetadata = parseBooleanArg(env.getOptions().get("obfuscateInjectorMetadata"), true);