Java Code Examples for org.apache.ivy.core.module.descriptor.MDArtifact#addConfiguration()

The following examples show how to use org.apache.ivy.core.module.descriptor.MDArtifact#addConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuildableIvyModuleResolveMetaData.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void attachArtifact(MDArtifact artifact, Set<String> configurations, DefaultModuleDescriptor target) {
    //The existing artifact configurations will be first
    Set<String> existingConfigurations = newLinkedHashSet(asList(artifact.getConfigurations()));
    for (String c : configurations) {
        if (!existingConfigurations.contains(c)) {
            artifact.addConfiguration(c);
            target.addArtifact(c, artifact);
        }
    }
}
 
Example 2
Source File: BuildableIvyModuleResolveMetaData.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void attachArtifact(MDArtifact artifact, Set<String> configurations, DefaultModuleDescriptor target) {
    //The existing artifact configurations will be first
    Set<String> existingConfigurations = newLinkedHashSet(asList(artifact.getConfigurations()));
    for (String c : configurations) {
        if (!existingConfigurations.contains(c)) {
            artifact.addConfiguration(c);
            target.addArtifact(c, artifact);
        }
    }
}
 
Example 3
Source File: XmlModuleDescriptorParser.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
protected void artifactStarted(String qName, Attributes attributes)
        throws MalformedURLException {
    if (state == State.PUB) {
        // this is a published artifact
        String artName = settings.substitute(attributes.getValue("name"));
        if (artName == null) {
            artName = getMd().getModuleRevisionId().getName();
        }
        String type = settings.substitute(attributes.getValue("type"));
        if (type == null) {
            type = "jar";
        }
        String ext = settings.substitute(attributes.getValue("ext"));
        if (ext == null) {
            ext = type;
        }
        String url = settings.substitute(attributes.getValue("url"));
        artifact = new MDArtifact(getMd(), artName, type, ext, url == null ? null
                : new URL(url), ExtendableItemHelper.getExtraAttributes(settings,
            attributes, Arrays.asList("ext", "type", "name", "conf")));
        String confs = settings.substitute(attributes.getValue("conf"));
        // only add confs if they are specified. if they aren't, endElement will
        // handle this
        // only if there are no conf defined in sub elements
        if (confs != null && confs.length() > 0) {
            String[] configs = "*".equals(confs) ? getMd().getConfigurationsNames()
                    : splitToArray(confs);
            for (String config : configs) {
                artifact.addConfiguration(config);
                getMd().addArtifact(config, artifact);
            }
        }
    } else if (state == State.DEP) {
        // this is an artifact asked for a particular dependency
        addDependencyArtifacts(qName, attributes);
    } else if (validate) {
        addError("artifact tag found in invalid tag: " + state);
    }
}