Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2014-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.gradle.dependencymanagement.internal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.spring.gradle.dependencymanagement.internal.DependencyManagementConfigurationContainer.ConfigurationConfigurer;
import org.gradle.api.Action;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.DependencySet;
import org.gradle.api.artifacts.ModuleDependency;
import org.gradle.api.artifacts.ResolvableDependencies;
import org.gradle.api.artifacts.component.ComponentSelector;
import org.gradle.api.artifacts.component.ModuleComponentSelector;
import org.gradle.api.artifacts.result.DependencyResult;
import org.gradle.api.artifacts.result.ResolutionResult;
import org.gradle.api.artifacts.result.ResolvedComponentResult;
import org.gradle.api.artifacts.result.ResolvedDependencyResult;
import org.gradle.api.artifacts.result.UnresolvedDependencyResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An {@link Action} to be applied to {@link ResolvableDependencies} that configures
* exclusions based on the Maven exclusion metadata gleaned from the dependencies.
*
* @author Andy Wilkinson
*/
class ExclusionConfiguringAction implements Action {
private static final Logger logger = LoggerFactory.getLogger(ExclusionConfiguringAction.class);
private final DependencyManagementSettings dependencyManagementSettings;
private final DependencyManagementContainer dependencyManagementContainer;
private final DependencyManagementConfigurationContainer configurationContainer;
private final Configuration configuration;
private final ExclusionResolver exclusionResolver;
private final ConfigurationConfigurer configurationConfigurer;
ExclusionConfiguringAction(DependencyManagementSettings dependencyManagementSettings,
DependencyManagementContainer dependencyManagementContainer,
DependencyManagementConfigurationContainer configurationContainer, Configuration configuration,
ExclusionResolver exclusionResolver, ConfigurationConfigurer configurationConfigurer) {
this.dependencyManagementSettings = dependencyManagementSettings;
this.dependencyManagementContainer = dependencyManagementContainer;
this.configurationContainer = configurationContainer;
this.configuration = configuration;
this.exclusionResolver = exclusionResolver;
this.configurationConfigurer = configurationConfigurer;
}
@Override
public void execute(ResolvableDependencies resolvableDependencies) {
if (this.dependencyManagementSettings.isApplyMavenExclusions()) {
applyMavenExclusions(resolvableDependencies);
}
}
private void applyMavenExclusions(ResolvableDependencies resolvableDependencies) {
Set excludedDependencies = findExcludedDependencies();
if (logger.isInfoEnabled()) {
logger.info("Excluding " + excludedDependencies);
}
List