Java 类org.gradle.api.artifacts.ExcludeRule 实例源码

项目:Reer    文件:MavenPomFileGenerator.java   
private void addDependency(MavenDependencyInternal dependency, String artifactId, String scope, String type, String classifier) {
    Dependency mavenDependency = new Dependency();
    mavenDependency.setGroupId(dependency.getGroupId());
    mavenDependency.setArtifactId(artifactId);
    mavenDependency.setVersion(mapToMavenSyntax(dependency.getVersion()));
    mavenDependency.setType(type);
    mavenDependency.setScope(scope);
    mavenDependency.setClassifier(classifier);

    for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(GUtil.elvis(excludeRule.getGroup(), "*"));
        exclusion.setArtifactId(GUtil.elvis(excludeRule.getModule(), "*"));
        mavenDependency.addExclusion(exclusion);
    }

    getModel().addDependency(mavenDependency);
}
项目:Reer    文件:IvyDescriptorFileGenerator.java   
private void writeDependencies(OptionalAttributeXmlWriter xmlWriter) throws IOException {
    xmlWriter.startElement("dependencies");
    for (IvyDependencyInternal dependency : dependencies) {
        xmlWriter.startElement("dependency")
                .attribute("org", dependency.getOrganisation())
                .attribute("name", dependency.getModule())
                .attribute("rev", dependency.getRevision())
                .attribute("conf", dependency.getConfMapping());

        if (!dependency.isTransitive()) {
            xmlWriter.attribute("transitive", "false");
        }

        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            printDependencyArtifact(dependencyArtifact, xmlWriter);
        }
        for(ExcludeRule excludeRule : dependency.getExcludeRules()) {
            writeDependencyExclude(excludeRule, xmlWriter);
        }
        xmlWriter.endElement();
    }
    xmlWriter.endElement();
}
项目:Pushjet-Android    文件:MavenPomFileGenerator.java   
private void addDependency(MavenDependencyInternal dependency, String artifactId, String scope, String type, String classifier) {
    Dependency mavenDependency = new Dependency();
    mavenDependency.setGroupId(dependency.getGroupId());
    mavenDependency.setArtifactId(artifactId);
    mavenDependency.setVersion(dependency.getVersion());
    mavenDependency.setType(type);
    mavenDependency.setScope(scope);
    mavenDependency.setClassifier(classifier);

    for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(GUtil.elvis(excludeRule.getGroup(), "*"));
        exclusion.setArtifactId(GUtil.elvis(excludeRule.getModule(), "*"));
        mavenDependency.addExclusion(exclusion);
    }

    getModel().addDependency(mavenDependency);
}
项目:Reer    文件:DefaultExcludeRuleConverter.java   
public Exclusion convert(ExcludeRule excludeRule) {
    if (isConvertable(excludeRule)) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(determineExclusionExpression(excludeRule.getGroup()));
        exclusion.setArtifactId(determineExclusionExpression(excludeRule.getModule()));
        return exclusion;
    }
    return null;
}
项目:Reer    文件:AbstractIvyDependencyDescriptorFactory.java   
protected List<Exclude> convertExcludeRules(final String configuration, Set<ExcludeRule> excludeRules) {
    return CollectionUtils.collect((Iterable<ExcludeRule>) excludeRules, new Transformer<Exclude, ExcludeRule>() {
        @Override
        public Exclude transform(ExcludeRule excludeRule) {
            return excludeRuleConverter.convertExcludeRule(configuration, excludeRule);
        }
    });
}
项目:Reer    文件:ExcludeRuleNotationConverter.java   
protected ExcludeRule parseMap(@MapKey(ExcludeRule.GROUP_KEY) @Optional String group,
                     @MapKey(ExcludeRule.MODULE_KEY) @Optional String module) {
    if (group == null && module == null) {
        throw new InvalidUserDataException("Dependency exclude rule requires 'group' and/or 'module' specified. For example: [group: 'com.google.collections']");
    }
    return new DefaultExcludeRule(group, module);
}
项目:Pushjet-Android    文件:DefaultExcludeRuleConverter.java   
public Exclusion convert(ExcludeRule excludeRule) {
    if (isConvertable(excludeRule)) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(excludeRule.getGroup());
        exclusion.setArtifactId(excludeRule.getModule());
        return exclusion;
    }
    return null;
}
项目:Pushjet-Android    文件:DefaultExcludeRuleConverter.java   
public DefaultExcludeRule createExcludeRule(String configurationName, ExcludeRule excludeRule) {
    String org = GUtil.elvis(excludeRule.getGroup(), PatternMatcher.ANY_EXPRESSION);
    String module = GUtil.elvis(excludeRule.getModule(), PatternMatcher.ANY_EXPRESSION);
    DefaultExcludeRule ivyExcludeRule = new DefaultExcludeRule(new ArtifactId(
            IvyUtil.createModuleId(org, module), PatternMatcher.ANY_EXPRESSION,
            PatternMatcher.ANY_EXPRESSION,
            PatternMatcher.ANY_EXPRESSION),
            ExactPatternMatcher.INSTANCE, null);
    ivyExcludeRule.addConfiguration(configurationName);
    return ivyExcludeRule;
}
项目:Pushjet-Android    文件:AbstractIvyDependencyDescriptorFactory.java   
private void addExcludes(String configuration, Set<ExcludeRule> excludeRules,
                         DefaultDependencyDescriptor dependencyDescriptor) {
    for (ExcludeRule excludeRule : excludeRules) {
        dependencyDescriptor.addExcludeRule(configuration, excludeRuleConverter.createExcludeRule(configuration,
                excludeRule));
    }
}
项目:Pushjet-Android    文件:DefaultDependenciesToModuleDescriptorConverter.java   
private void addExcludeRules(MutableLocalComponentMetaData metaData, Collection<? extends Configuration> configurations) {
    for (Configuration configuration : configurations) {
        for (ExcludeRule excludeRule : configuration.getExcludeRules()) {
            org.apache.ivy.core.module.descriptor.ExcludeRule rule = excludeRuleConverter.createExcludeRule(
                    configuration.getName(), excludeRule);
            metaData.addExcludeRule(rule);
        }
    }
}
项目:Pushjet-Android    文件:ExcludeRuleNotationParser.java   
protected ExcludeRule parseMap(@MapKey(ExcludeRule.GROUP_KEY) @Optional String group,
                     @MapKey(ExcludeRule.MODULE_KEY) @Optional String module) {
    if (group == null && module == null) {
        throw new InvalidUserDataException("Dependency exclude rule requires 'group' and/or 'module' specified. For example: [group: 'com.google.collections']");
    }
    return new DefaultExcludeRule(group, module);
}
项目:Pushjet-Android    文件:DefaultExcludeRuleConverter.java   
public Exclusion convert(ExcludeRule excludeRule) {
    if (isConvertable(excludeRule)) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId(excludeRule.getGroup());
        exclusion.setArtifactId(excludeRule.getModule());
        return exclusion;
    }
    return null;
}
项目:Pushjet-Android    文件:DefaultExcludeRuleConverter.java   
public DefaultExcludeRule createExcludeRule(String configurationName, ExcludeRule excludeRule) {
    String org = GUtil.elvis(excludeRule.getGroup(), PatternMatcher.ANY_EXPRESSION);
    String module = GUtil.elvis(excludeRule.getModule(), PatternMatcher.ANY_EXPRESSION);
    DefaultExcludeRule ivyExcludeRule = new DefaultExcludeRule(new ArtifactId(
            IvyUtil.createModuleId(org, module), PatternMatcher.ANY_EXPRESSION,
            PatternMatcher.ANY_EXPRESSION,
            PatternMatcher.ANY_EXPRESSION),
            ExactPatternMatcher.INSTANCE, null);
    ivyExcludeRule.addConfiguration(configurationName);
    return ivyExcludeRule;
}
项目:Pushjet-Android    文件:AbstractIvyDependencyDescriptorFactory.java   
private void addExcludes(String configuration, Set<ExcludeRule> excludeRules,
                         DefaultDependencyDescriptor dependencyDescriptor) {
    for (ExcludeRule excludeRule : excludeRules) {
        dependencyDescriptor.addExcludeRule(configuration, excludeRuleConverter.createExcludeRule(configuration,
                excludeRule));
    }
}
项目:Pushjet-Android    文件:DefaultDependenciesToModuleDescriptorConverter.java   
private void addExcludeRules(DefaultModuleDescriptor moduleDescriptor, Collection<? extends Configuration> configurations) {
    for (Configuration configuration : configurations) {
        for (ExcludeRule excludeRule : configuration.getExcludeRules()) {
            org.apache.ivy.core.module.descriptor.ExcludeRule rule = excludeRuleConverter.createExcludeRule(
                    configuration.getName(), excludeRule);
            moduleDescriptor.addExcludeRule(rule);
        }
    }
}
项目:Pushjet-Android    文件:DefaultExcludeRule.java   
public Map<String, String> getExcludeArgs() {
    DeprecationLogger.nagUserOfDeprecated("The getExcludeArgs method", "Please use the getGroup() method or the getModule() method instead");
    Map excludeArgsAsMap = new HashMap();
    excludeArgsAsMap.put(ExcludeRule.GROUP_KEY, group);
    excludeArgsAsMap.put(ExcludeRule.MODULE_KEY, module);
    return excludeArgsAsMap;
}
项目:Pushjet-Android    文件:ExcludeRuleNotationParser.java   
protected ExcludeRule parseMap(@MapKey(ExcludeRule.GROUP_KEY) @Optional String group,
                     @MapKey(ExcludeRule.MODULE_KEY) @Optional String module) {
    if (group == null && module == null) {
        throw new InvalidUserDataException("Either a group or module must be specified. For example: [group:'org.gradle']");
    }
    DefaultExcludeRule excluderule = new DefaultExcludeRule();
    excluderule.setGroup(group);
    excluderule.setModule(module);
    return excluderule;
}
项目:Reer    文件:DefaultExcludeRuleConverter.java   
private boolean isConvertable(ExcludeRule excludeRule) {
    return excludeRule.getGroup()!= null || excludeRule.getModule()!= null;
}
项目:Reer    文件:DefaultMavenDependency.java   
public DefaultMavenDependency(String groupId, String artifactId, String version, Collection<DependencyArtifact> artifacts, Collection<ExcludeRule> excludeRules) {
    this(groupId, artifactId, version, artifacts);
    this.excludeRules.addAll(excludeRules);
}
项目:Reer    文件:DefaultMavenDependency.java   
public Collection<ExcludeRule> getExcludeRules() {
    return excludeRules;
}
项目:Reer    文件:DefaultDependenciesToModuleDescriptorConverter.java   
private void addExcludeRules(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
    for (ExcludeRule excludeRule : configuration.getExcludeRules()) {
        metaData.addExclude(excludeRuleConverter.convertExcludeRule(configuration.getName(), excludeRule));
    }
}
项目:Reer    文件:DefaultExcludeRuleConverter.java   
public DefaultExclude convertExcludeRule(String configurationName, ExcludeRule excludeRule) {
    String org = GUtil.elvis(excludeRule.getGroup(), PatternMatchers.ANY_EXPRESSION);
    String module = GUtil.elvis(excludeRule.getModule(), PatternMatchers.ANY_EXPRESSION);
    return new DefaultExclude(org, module, new String[] {configurationName}, PatternMatchers.EXACT);
}
项目:Reer    文件:DefaultConfiguration.java   
public Set<ExcludeRule> getExcludeRules() {
    return Collections.unmodifiableSet(excludeRules);
}
项目:Reer    文件:DefaultConfiguration.java   
public void setExcludeRules(Set<ExcludeRule> excludeRules) {
    validateMutation(MutationType.DEPENDENCIES);
    this.excludeRules = excludeRules;
}
项目:Reer    文件:DefaultConfiguration.java   
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;
}
项目:Reer    文件:IvyDescriptorFileGenerator.java   
private void writeDependencyExclude(ExcludeRule excludeRule, OptionalAttributeXmlWriter xmlWriter) throws IOException {
    xmlWriter.startElement("exclude")
        .attribute("org", excludeRule.getGroup())
        .attribute("module", excludeRule.getModule())
        .endElement();
}
项目:Reer    文件:DefaultIvyDependency.java   
public DefaultIvyDependency(String organisation, String module, String revision, String confMapping, boolean transitive, Collection<DependencyArtifact> artifacts, Collection<ExcludeRule> excludeRules) {
    this(organisation, module, revision, confMapping, transitive, artifacts);
    this.excludeRules.addAll(excludeRules);
}
项目:Reer    文件:DefaultIvyDependency.java   
public Iterable<ExcludeRule> getExcludeRules() {
    return excludeRules;
}
项目:Reer    文件:DefaultExcludeRuleContainer.java   
public DefaultExcludeRuleContainer(Set<ExcludeRule> addedRules) {
    this.addedRules = new HashSet<ExcludeRule>(addedRules);
}
项目:Reer    文件:DefaultExcludeRuleContainer.java   
public void add(Map<String, String> args) {
    if (addedRules == null) {
        addedRules = new HashSet<ExcludeRule>();
    }
    addedRules.add(ExcludeRuleNotationConverter.parser().parseNotation(args));
}
项目:Reer    文件:DefaultExcludeRuleContainer.java   
public Set<ExcludeRule> getRules() {
    return addedRules == null ? Collections.<ExcludeRule>emptySet() : addedRules;
}
项目:Reer    文件:AbstractModuleDependency.java   
public Set<ExcludeRule> getExcludeRules() {
    return excludeRuleContainer.getRules();
}
项目:Reer    文件:ExcludeRuleNotationConverter.java   
public static NotationParser<Object, ExcludeRule> parser() {
    return PARSER;
}
项目:Pushjet-Android    文件:DefaultExcludeRuleConverter.java   
private boolean isConvertable(ExcludeRule excludeRule) {
    return excludeRule.getGroup()!=null && excludeRule.getModule()!=null;
}
项目:Pushjet-Android    文件:DefaultMavenDependency.java   
public DefaultMavenDependency(String groupId, String artifactId, String version, Collection<DependencyArtifact> artifacts, Collection<ExcludeRule> excludeRules) {
    this(groupId, artifactId, version, artifacts);
    this.excludeRules.addAll(excludeRules);
}
项目:Pushjet-Android    文件:DefaultMavenDependency.java   
public Collection<ExcludeRule> getExcludeRules() {
    return excludeRules;
}
项目:Pushjet-Android    文件:DefaultExcludeRuleContainer.java   
public DefaultExcludeRuleContainer(Set<ExcludeRule> addedRules) {
    this.addedRules = new HashSet<ExcludeRule>(addedRules);
}
项目:Pushjet-Android    文件:DefaultExcludeRuleContainer.java   
public Set<ExcludeRule> getRules() {
    return addedRules;
}
项目:Pushjet-Android    文件:DefaultExcludeRuleConverter.java   
private boolean isConvertable(ExcludeRule excludeRule) {
    return excludeRule.getGroup()!=null && excludeRule.getModule()!=null;
}
项目:Pushjet-Android    文件:DefaultExcludeRuleContainer.java   
public DefaultExcludeRuleContainer(Set<ExcludeRule> addedRules) {
    this.addedRules = new HashSet<ExcludeRule>(addedRules);
}