Skip to content

Commit 66ff9ec

Browse files
UCT-723: changed reindexing, reindexed API coverage index
1 parent c463f8d commit 66ff9ec

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed
-79.1 KB
Binary file not shown.

src/com/magento/idea/magento2uct/versioning/processors/util/VersioningDataOperationsUtil.java

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
import com.google.common.collect.Sets;
99
import com.intellij.openapi.util.Pair;
10+
import com.magento.idea.magento2uct.packages.SupportedVersion;
11+
12+
import java.util.ArrayList;
13+
import java.util.Comparator;
1014
import java.util.HashMap;
15+
import java.util.LinkedList;
1116
import java.util.List;
1217
import java.util.Map;
1318
import java.util.Set;
@@ -68,12 +73,26 @@ public static Pair<Map<String, Boolean>, Map<String, String>> unionVersionDataWi
6873
final boolean shouldKeepNew
6974
) {
7075
final Map<String, Boolean> union = new HashMap<>();
71-
final Map<String, Boolean> removedUnion = new HashMap<>();
76+
Map<String, Boolean> removedUnion = new HashMap<>();
7277
final Map<String, String> changelog = new HashMap<>();
78+
final List<String> versions = new LinkedList<>(versioningData.keySet());
79+
80+
versions.sort((key1, key2) -> {
81+
final SupportedVersion version1 = SupportedVersion.getVersion(key1);
82+
final SupportedVersion version2 = SupportedVersion.getVersion(key2);
83+
84+
if (version1 == null || version2 == null) {
85+
return 0;
86+
}
87+
88+
return version1.compareTo(version2);
89+
});
90+
91+
for (final String version : versions) {
92+
final Map<String, Boolean> vData = versioningData.get(version);
7393

74-
for (final Map.Entry<String, Map<String, Boolean>> vData : versioningData.entrySet()) {
7594
final Set<Map.Entry<String, Boolean>> removedSet = Sets.filter(
76-
vData.getValue().entrySet(),
95+
vData.entrySet(),
7796
entry -> !entry.getValue()
7897
);
7998
final Map<String, Boolean> removedData = removedSet.stream().collect(
@@ -85,7 +104,7 @@ public static Pair<Map<String, Boolean>, Map<String, String>> unionVersionDataWi
85104
removedUnion.putAll(removedData);
86105

87106
final Sets.SetView<Map.Entry<String, Boolean>> newDataSet = Sets.difference(
88-
vData.getValue().entrySet(),
107+
vData.entrySet(),
89108
removedSet
90109
);
91110
final Map<String, Boolean> newData = newDataSet.stream().collect(Collectors.toMap(
@@ -94,11 +113,27 @@ public static Pair<Map<String, Boolean>, Map<String, String>> unionVersionDataWi
94113
));
95114
union.putAll(newData);
96115

97-
if (!excludeFromChangelog.contains(vData.getKey())) {
116+
final Sets.SetView<Map.Entry<String, Boolean>> returnedSet = Sets.intersection(
117+
newData.entrySet(),
118+
removedUnion.entrySet()
119+
);
120+
121+
if (!returnedSet.isEmpty()) {
122+
final Sets.SetView<Map.Entry<String, Boolean>> updatedRemovedUnionSet =
123+
Sets.difference(removedUnion.entrySet(), returnedSet);
124+
removedUnion = new HashMap<>(updatedRemovedUnionSet.stream().collect(
125+
Collectors.toMap(
126+
Map.Entry::getKey,
127+
Map.Entry::getValue
128+
)
129+
));
130+
}
131+
132+
if (!excludeFromChangelog.contains(version)) {
98133
if (shouldKeepNew) {
99-
newData.forEach((key, value) -> changelog.put(key, vData.getKey()));
134+
newData.forEach((key, value) -> changelog.put(key, version));
100135
} else {
101-
removedData.forEach((key, value) -> changelog.put(key, vData.getKey()));
136+
removedData.forEach((key, value) -> changelog.put(key, version));
102137
}
103138
}
104139
}

0 commit comments

Comments
 (0)