Skip to content

Commit 50b9d56

Browse files
Merge pull request #325 from org-metaeffekt/AE-1672-runtime-filtering
AE-1672: enable artifact filtering also for non-web-modules
2 parents 82ae299 + b06566e commit 50b9d56

File tree

1 file changed

+29
-33
lines changed
  • libraries/ae-inventory-processor/src/main/java/org/metaeffekt/core/inventory

1 file changed

+29
-33
lines changed

libraries/ae-inventory-processor/src/main/java/org/metaeffekt/core/inventory/InventoryUtils.java

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ public static void removeArtifactAttributeStartingWith(Inventory inventory, Stri
350350

351351
@Deprecated // use SheetSerializationContext instead
352352
protected static void removeAttributes(Inventory inventory, Collection<String> keys) {
353-
final ArrayList<String> list = inventory.getSerializationContext().
354-
get(CONTEXT_ARTIFACT_DATA_COLUMN_LIST);
353+
final ArrayList<String> list = inventory.getSerializationContext().get(CONTEXT_ARTIFACT_DATA_COLUMN_LIST);
355354

356355
for (Artifact artifact : inventory.getArtifacts()) {
357356
for (String attribute : new HashSet<>(artifact.getAttributes())) {
@@ -440,40 +439,38 @@ public static void filterInventoryForRuntimeArtifacts(Inventory inventory, Colle
440439
for (Artifact artifact : inventory.getArtifacts()) {
441440
String type = artifact.get(Artifact.Attribute.TYPE);
442441
if (type == null) continue;
443-
if (type.equals("web-module") || type.equals("nodejs-module")) {
444-
boolean remove = true;
445-
446-
// hasMarker tracks whether an artifact has markers within primaryAssetIds; in case not, nothing is removed
447-
boolean hasMarker = false;
448-
for (String aid : primaryAssetIds) {
449-
final String assetMarker = artifact.get(aid);
450-
if (StringUtils.isNotBlank(assetMarker)) {
451-
hasMarker = true;
452-
}
453-
if ("(r)".equals(assetMarker)) {
454-
remove = false;
455-
break;
456-
}
457-
if ("r".equals(assetMarker)) {
458-
remove = false;
459-
break;
460-
}
442+
boolean remove = true;
443+
444+
// hasMarker tracks whether an artifact has markers within primaryAssetIds; in case not, nothing is removed
445+
boolean hasMarker = false;
446+
for (String aid : primaryAssetIds) {
447+
final String assetMarker = artifact.get(aid);
448+
if (StringUtils.isNotBlank(assetMarker)) {
449+
hasMarker = true;
450+
}
451+
if ("(r)".equals(assetMarker)) {
452+
remove = false;
453+
break;
454+
}
455+
if ("r".equals(assetMarker)) {
456+
remove = false;
457+
break;
458+
}
461459

462-
// contains implies runtime (also considers old/imprecise markers)
463-
if ("c".equals(assetMarker)) {
464-
remove = false;
465-
break;
466-
}
467-
// consider old/imprecise markers; cross marker was used for any type of relationship
468-
if ("x".equals(assetMarker)) {
469-
remove = false;
470-
break;
471-
}
460+
// contains implies runtime (also considers old/imprecise markers)
461+
if ("c".equals(assetMarker)) {
462+
remove = false;
463+
break;
472464
}
473-
if (remove && hasMarker) {
474-
removableArtifacts.add(artifact);
465+
// consider old/imprecise markers; cross marker was used for any type of relationship
466+
if ("x".equals(assetMarker)) {
467+
remove = false;
468+
break;
475469
}
476470
}
471+
if (remove && hasMarker) {
472+
removableArtifacts.add(artifact);
473+
}
477474
}
478475
inventory.getArtifacts().removeAll(removableArtifacts);
479476
}
@@ -517,5 +514,4 @@ private static Map<String, List<Artifact>> buildQualifierArtifactMap(Inventory i
517514
return qualifierArtifactMap;
518515
}
519516

520-
521517
}

0 commit comments

Comments
 (0)