From 15f23d82ed628c0a3d197220b265588433550ef5 Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Mon, 11 Nov 2024 21:18:27 +0100 Subject: [PATCH] Fix for GAL-369, Introduce a System property to disable capability checks --- .../galleon/runtime/DefaultBranchedConfigArranger.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/jboss/galleon/runtime/DefaultBranchedConfigArranger.java b/core/src/main/java/org/jboss/galleon/runtime/DefaultBranchedConfigArranger.java index fa3c60f3b..a586a6f3a 100644 --- a/core/src/main/java/org/jboss/galleon/runtime/DefaultBranchedConfigArranger.java +++ b/core/src/main/java/org/jboss/galleon/runtime/DefaultBranchedConfigArranger.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 Red Hat, Inc. and/or its affiliates + * Copyright 2016-2024 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -72,6 +72,7 @@ private static boolean getBooleanProp(Map props, String name, bo private List orderedFeatures = Collections.emptyList(); private List independentBatchBranch = Collections.emptyList(); private List independentNonBatchBranch = Collections.emptyList(); + private final boolean ignoreCapabilities; DefaultBranchedConfigArranger(ConfigModelStack configStack) { this.configStack = configStack; @@ -83,6 +84,8 @@ private static boolean getBooleanProp(Map props, String name, bo branchIsBatch = getBooleanProp(configStack.props, ConfigModel.BRANCH_IS_BATCH, false); isolateCircularDeps = getBooleanProp(configStack.props, ConfigModel.ISOLATE_CIRCULAR_DEPS, false); mergeIndependentBranches = getBooleanProp(configStack.props, ConfigModel.MERGE_INDEPENDENT_BRANCHES, false); + // When analyzing incomplete configuration, capabilities can be missing and capability check be disabled. + ignoreCapabilities = Boolean.getBoolean("org.jboss.galleon.internal.ignore.capability.providers"); } List orderFeatures() throws ProvisioningException { @@ -626,7 +629,7 @@ private List orderCapabilityProviders(ResolvedFeature feature, throws ProvisioningException { for (CapabilitySpec capSpec : feature.spec.xmlSpec.getRequiredCapabilities()) { final List resolvedCaps = capResolver.resolve(capSpec, feature); - if (resolvedCaps.isEmpty()) { + if (resolvedCaps.isEmpty() || ignoreCapabilities) { continue; } for (String resolvedCap : resolvedCaps) {