fix: preserve renames on mapping export (#1732)(PR #1893)

This commit is contained in:
Julian Burner
2023-06-03 15:20:06 +02:00
committed by GitHub
parent e9a7ccd00c
commit fa67f4fef7
@@ -144,10 +144,12 @@ public class MappingExporter {
String srcNamespace = MappingUtil.NS_SOURCE_FALLBACK; String srcNamespace = MappingUtil.NS_SOURCE_FALLBACK;
String dstNamespace = MappingUtil.NS_TARGET_FALLBACK; String dstNamespace = MappingUtil.NS_TARGET_FALLBACK;
// Copy mappings from potentially imported mappings file
if (loadedMappingTree != null && loadedMappingTree.getDstNamespaces() != null) { if (loadedMappingTree != null && loadedMappingTree.getDstNamespaces() != null) {
srcNamespace = loadedMappingTree.getSrcNamespace(); loadedMappingTree.accept(mappingTree);
dstNamespace = loadedMappingTree.getDstNamespaces().get(0);
} }
mappingTree.visitHeader(); mappingTree.visitHeader();
mappingTree.visitNamespaces(srcNamespace, Collections.singletonList(dstNamespace)); mappingTree.visitNamespaces(srcNamespace, Collections.singletonList(dstNamespace));
mappingTree.visitContent(); mappingTree.visitContent();
@@ -243,10 +245,6 @@ public class MappingExporter {
} }
} }
} }
// Copy mappings from potentially imported mappings file
if (loadedMappingTree != null && loadedMappingTree.getDstNamespaces() != null) {
loadedMappingTree.accept(mappingTree);
}
// Write file // Write file
MappingWriter writer = MappingWriter.create(path, mappingFormat); MappingWriter writer = MappingWriter.create(path, mappingFormat);
mappingTree.accept(writer); mappingTree.accept(writer);