Search in sources :

Example 1 with ConfigurationNotFoundException

use of org.gradle.internal.component.model.ConfigurationNotFoundException in project gradle by gradle.

the class IvyDependencyMetadata method findMatches.

private void findMatches(ComponentResolveMetadata fromComponent, ComponentResolveMetadata targetComponent, String fromConfiguration, String patternConfiguration, String targetPattern, Set<ConfigurationMetadata> targetConfigurations) {
    int startFallback = targetPattern.indexOf('(');
    if (startFallback >= 0) {
        if (targetPattern.endsWith(")")) {
            String preferred = targetPattern.substring(0, startFallback);
            ConfigurationMetadata configuration = targetComponent.getConfiguration(preferred);
            if (configuration != null) {
                targetConfigurations.add(configuration);
                return;
            }
            targetPattern = targetPattern.substring(startFallback + 1, targetPattern.length() - 1);
        }
    }
    if (targetPattern.equals("*")) {
        for (String targetName : targetComponent.getConfigurationNames()) {
            ConfigurationMetadata configuration = targetComponent.getConfiguration(targetName);
            if (configuration.isVisible()) {
                targetConfigurations.add(configuration);
            }
        }
        return;
    }
    if (targetPattern.equals("@")) {
        targetPattern = patternConfiguration;
    } else if (targetPattern.equals("#")) {
        targetPattern = fromConfiguration;
    }
    ConfigurationMetadata configuration = targetComponent.getConfiguration(targetPattern);
    if (configuration == null) {
        throw new ConfigurationNotFoundException(fromComponent.getComponentId(), fromConfiguration, targetPattern, targetComponent.getComponentId());
    }
    targetConfigurations.add(configuration);
}
Also used : ConfigurationNotFoundException(org.gradle.internal.component.model.ConfigurationNotFoundException) ConfigurationMetadata(org.gradle.internal.component.model.ConfigurationMetadata)

Aggregations

ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)1 ConfigurationNotFoundException (org.gradle.internal.component.model.ConfigurationNotFoundException)1