當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getExcludeRules方法代碼示例

本文整理匯總了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;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:51,代碼來源:DefaultConfiguration.java


注:本文中的org.gradle.api.artifacts.Configuration.getExcludeRules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。