本文整理匯總了Java中org.gradle.api.artifacts.Configuration.getExcludeRules方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getExcludeRules方法的具體用法?Java Configuration.getExcludeRules怎麽用?Java Configuration.getExcludeRules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.gradle.api.artifacts.Configuration
的用法示例。
在下文中一共展示了Configuration.getExcludeRules方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCopy
import org.gradle.api.artifacts.Configuration; //導入方法依賴的package包/類
private DefaultConfiguration createCopy(Set<Dependency> dependencies, boolean recursive) {
DetachedConfigurationsProvider configurationsProvider = new DetachedConfigurationsProvider();
String newName = name + "Copy";
Path newIdentityPath = identityPath.getParent().child(newName);
Path newPath = path.getParent().child(newName);
DefaultConfiguration copiedConfiguration = instantiator.newInstance(DefaultConfiguration.class, newIdentityPath, newPath, newName,
configurationsProvider, resolver, listenerManager, metaDataProvider, resolutionStrategy.copy(), projectAccessListener, projectFinder, configurationComponentMetaDataBuilder, fileCollectionFactory, componentIdentifierFactory, buildOperationExecutor, instantiator, artifactNotationParser);
configurationsProvider.setTheOnlyConfiguration(copiedConfiguration);
// state, cachedResolvedConfiguration, and extendsFrom intentionally not copied - must re-resolve copy
// copying extendsFrom could mess up dependencies when copy was re-resolved
copiedConfiguration.visible = visible;
copiedConfiguration.transitive = transitive;
copiedConfiguration.description = description;
copiedConfiguration.defaultDependencyActions.addAll(defaultDependencyActions);
copiedConfiguration.canBeConsumed = canBeConsumed;
copiedConfiguration.canBeResolved = canBeResolved;
copiedConfiguration.getArtifacts().addAll(getAllArtifacts());
if (hasAttributes()) {
for (Attribute<?> attribute : configurationAttributes.keySet()) {
Object value = configurationAttributes.getAttribute(attribute);
copiedConfiguration.attribute(Cast.<Attribute<Object>>uncheckedCast(attribute), value);
}
}
// todo An ExcludeRule is a value object but we don't enforce immutability for DefaultExcludeRule as strong as we
// should (we expose the Map). We should provide a better API for ExcludeRule (I don't want to use unmodifiable Map).
// As soon as DefaultExcludeRule is truly immutable, we don't need to create a new instance of DefaultExcludeRule.
Set<Configuration> excludeRuleSources = new LinkedHashSet<Configuration>();
excludeRuleSources.add(this);
if (recursive) {
excludeRuleSources.addAll(getHierarchy());
}
for (Configuration excludeRuleSource : excludeRuleSources) {
for (ExcludeRule excludeRule : excludeRuleSource.getExcludeRules()) {
copiedConfiguration.excludeRules.add(new DefaultExcludeRule(excludeRule.getGroup(), excludeRule.getModule()));
}
}
DomainObjectSet<Dependency> copiedDependencies = copiedConfiguration.getDependencies();
for (Dependency dependency : dependencies) {
copiedDependencies.add(dependency.copy());
}
return copiedConfiguration;
}