Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marchermans/5f383a545f2c09307a40589425347069 to your computer and use it in GitHub Desktop.
Save marchermans/5f383a545f2c09307a40589425347069 to your computer and use it in GitHub Desktop.
@Component
public class IntermediaryMappingFileExtractor extends AbstractMappingParsingProcessor {
protected IntermediaryMappingFileExtractor() {
super(
(releaseName) -> Lists.newArrayList(Paths.get(Constants.INTERMEDIARY_WORKING_DIR, "mappings", "mappings.tiny")),
(line, releaseName) -> {
if (!line.startsWith("CLASS"))
return null;
final String[] components = line.split("\t");
String parentClassOut = null;
if (components[2].contains("$"))
parentClassOut = components[2].substring(0, components[2].indexOf("$"));
return new ExternalMapping(
components[1],
components[2],
ExternalMappableType.CLASS,
releaseName,
releaseName,
parentClassOut,
null,
null,
null,
null,
null
);
},
(classes, line, releaseName) -> {
if (!line.startsWith("METHOD"))
return null;
final String[] components = line.split("\t");
final String parentClassOut = classes.get(components[1]).getOutput();
return new ExternalMapping(
components[3],
components[4],
ExternalMappableType.METHOD,
releaseName,
releaseName,
parentClassOut,
null,
null,
null,
components[2],
null);
},
(classes, line, releaseName) -> {
if (!line.startsWith("FIELD"))
return null;
final String[] components = line.split("\t");
final String parentClassOut = classes.get(components[1]).getOutput();
return new ExternalMapping(
components[3],
components[4],
ExternalMappableType.FIELD,
releaseName,
releaseName,
parentClassOut,
null,
null,
components[2],
null,
null
);
},
IParameterParser.NOOP,
Constants.INTERMEDIARY_MAPPING_NAME
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment