org.gradle.api.artifacts.DependencyArtifact Java Examples

The following examples show how to use org.gradle.api.artifacts.DependencyArtifact. 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: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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());

        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            printDependencyArtifact(dependencyArtifact, xmlWriter);
        }
        xmlWriter.endElement();
    }
    xmlWriter.endElement();
}
 
Example #2
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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());

        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            printDependencyArtifact(dependencyArtifact, xmlWriter);
        }
        xmlWriter.endElement();
    }
    xmlWriter.endElement();
}
 
Example #3
Source File: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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());

        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            printDependencyArtifact(dependencyArtifact, xmlWriter);
        }
        xmlWriter.endElement();
    }
    xmlWriter.endElement();
}
 
Example #4
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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());

        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            printDependencyArtifact(dependencyArtifact, xmlWriter);
        }
        xmlWriter.endElement();
    }
    xmlWriter.endElement();
}
 
Example #5
Source File: MavenPomFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addDependency(MavenDependencyInternal mavenDependency, String scope) {
    if (mavenDependency.getArtifacts().size() == 0) {
        addDependency(mavenDependency, mavenDependency.getArtifactId(), scope, null, null);
    } else {
        for (DependencyArtifact artifact : mavenDependency.getArtifacts()) {
            addDependency(mavenDependency, artifact.getName(), scope, artifact.getType(), artifact.getClassifier());
        }
    }
}
 
Example #6
Source File: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private boolean usesClassifier() {
    for (IvyArtifact artifact : artifacts) {
        if (artifact.getClassifier() != null) {
            return true;
        }
    }
    for (IvyDependencyInternal dependency : this.dependencies) {
        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            if (dependencyArtifact.getClassifier() != null) {
                return true;
            }
        }
    }
    return false;
}
 
Example #7
Source File: MavenPomFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addDependency(MavenDependencyInternal mavenDependency, String scope) {
    if (mavenDependency.getArtifacts().size() == 0) {
        addDependency(mavenDependency, mavenDependency.getArtifactId(), scope, null, null);
    } else {
        for (DependencyArtifact artifact : mavenDependency.getArtifacts()) {
            addDependency(mavenDependency, artifact.getName(), scope, artifact.getType(), artifact.getClassifier());
        }
    }
}
 
Example #8
Source File: MavenPomFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addDependency(MavenDependencyInternal mavenDependency, String scope) {
    if (mavenDependency.getArtifacts().size() == 0) {
        addDependency(mavenDependency, mavenDependency.getArtifactId(), scope, null, null);
    } else {
        for (DependencyArtifact artifact : mavenDependency.getArtifacts()) {
            addDependency(mavenDependency, artifact.getName(), scope, artifact.getType(), artifact.getClassifier());
        }
    }
}
 
Example #9
Source File: CreateDependencyInfoFile.java    From shipkit with MIT License 5 votes vote down vote up
private String getDependencyWithArtifacts(CreateDependencyInfoFileTask task, ModuleDependency dependency) {
    String result = getDependency(task, dependency);
    if (!dependency.getArtifacts().isEmpty()) {
        //sorting artifacts to assure that they are always in the same order
        //without depending on Gradle implementation
        SortedSet<String> artifacts = new TreeSet<>();
        for (DependencyArtifact artifact : dependency.getArtifacts()) {
            artifacts.add(getArtifact(artifact));
        }
        return result + ARTIFACT_INDENT + StringUtil.join(artifacts, ARTIFACT_INDENT);
    }
    return result;
}
 
Example #10
Source File: ModuleFactoryHelper.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
 
Example #11
Source File: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void printDependencyArtifact(DependencyArtifact dependencyArtifact, OptionalAttributeXmlWriter xmlWriter) throws IOException {
    // TODO Use IvyArtifact here
    xmlWriter.startElement("artifact")
            .attribute("name", dependencyArtifact.getName())
            .attribute("type", dependencyArtifact.getType())
            .attribute("ext", dependencyArtifact.getExtension())
            .attribute("m:classifier", dependencyArtifact.getClassifier())
            .endElement();
}
 
Example #12
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void printDependencyArtifact(DependencyArtifact dependencyArtifact, OptionalAttributeXmlWriter xmlWriter) throws IOException {
    // TODO Use IvyArtifact here
    xmlWriter.startElement("artifact")
            .attribute("name", dependencyArtifact.getName())
            .attribute("type", dependencyArtifact.getType())
            .attribute("ext", dependencyArtifact.getExtension())
            .attribute("m:classifier", dependencyArtifact.getClassifier())
            .endElement();
}
 
Example #13
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private boolean usesClassifier() {
    for (IvyArtifact artifact : artifacts) {
        if (artifact.getClassifier() != null) {
            return true;
        }
    }
    for (IvyDependencyInternal dependency : this.dependencies) {
        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            if (dependencyArtifact.getClassifier() != null) {
                return true;
            }
        }
    }
    return false;
}
 
Example #14
Source File: ModuleFactoryHelper.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
 
Example #15
Source File: MavenPomFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addDependency(MavenDependencyInternal mavenDependency, String scope) {
    if (mavenDependency.getArtifacts().size() == 0) {
        addDependency(mavenDependency, mavenDependency.getArtifactId(), scope, null, null);
    } else {
        for (DependencyArtifact artifact : mavenDependency.getArtifacts()) {
            addDependency(mavenDependency, artifact.getName(), scope, artifact.getType(), artifact.getClassifier());
        }
    }
}
 
Example #16
Source File: ModuleFactoryHelper.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
 
Example #17
Source File: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private boolean usesClassifier() {
    for (IvyArtifact artifact : artifacts) {
        if (artifact.getClassifier() != null) {
            return true;
        }
    }
    for (IvyDependencyInternal dependency : this.dependencies) {
        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            if (dependencyArtifact.getClassifier() != null) {
                return true;
            }
        }
    }
    return false;
}
 
Example #18
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void printDependencyArtifact(DependencyArtifact dependencyArtifact, OptionalAttributeXmlWriter xmlWriter) throws IOException {
    // TODO Use IvyArtifact here
    xmlWriter.startElement("artifact")
            .attribute("name", dependencyArtifact.getName())
            .attribute("type", dependencyArtifact.getType())
            .attribute("ext", dependencyArtifact.getExtension())
            .attribute("m:classifier", dependencyArtifact.getClassifier())
            .endElement();
}
 
Example #19
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private boolean usesClassifier() {
    for (IvyArtifact artifact : artifacts) {
        if (artifact.getClassifier() != null) {
            return true;
        }
    }
    for (IvyDependencyInternal dependency : this.dependencies) {
        for (DependencyArtifact dependencyArtifact : dependency.getArtifacts()) {
            if (dependencyArtifact.getClassifier() != null) {
                return true;
            }
        }
    }
    return false;
}
 
Example #20
Source File: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void printDependencyArtifact(DependencyArtifact dependencyArtifact, OptionalAttributeXmlWriter xmlWriter) throws IOException {
    // TODO Use IvyArtifact here
    xmlWriter.startElement("artifact")
            .attribute("name", dependencyArtifact.getName())
            .attribute("type", dependencyArtifact.getType())
            .attribute("ext", dependencyArtifact.getExtension())
            .attribute("m:classifier", dependencyArtifact.getClassifier())
            .endElement();
}
 
Example #21
Source File: ModuleFactoryHelper.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void addExplicitArtifactsIfDefined(ExternalDependency moduleDependency, String artifactType, String classifier) {
    String actualArtifactType = artifactType;
    if (actualArtifactType == null) {
        if (classifier != null) {
            actualArtifactType = DependencyArtifact.DEFAULT_TYPE;
        }
    } else {
        moduleDependency.setTransitive(false);
    }
    if (actualArtifactType != null) {
        moduleDependency.addArtifact(new DefaultDependencyArtifact(moduleDependency.getName(),
                actualArtifactType, actualArtifactType, classifier, null));
    }
}
 
Example #22
Source File: CreateDependencyInfoFile.java    From shipkit with MIT License 4 votes vote down vote up
private String getArtifact(DependencyArtifact artifact) {
    return artifact.getName() + SEPARATOR +
        artifact.getClassifier() + SEPARATOR +
        artifact.getType() + SEPARATOR +
        artifact.getExtension();
}
 
Example #23
Source File: DefaultMavenDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenDependency(String groupId, String artifactId, String version, Collection<DependencyArtifact> artifacts) {
    this(groupId, artifactId, version);
    this.artifacts.addAll(artifacts);
}
 
Example #24
Source File: DefaultMavenDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Collection<DependencyArtifact> getArtifacts() {
    return artifacts;
}
 
Example #25
Source File: DefaultIvyDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Iterable<DependencyArtifact> getArtifacts() {
    return artifacts;
}
 
Example #26
Source File: DefaultIvyDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultIvyDependency(String organisation, String module, String revision, String confMapping, Collection<DependencyArtifact> artifacts) {
    this(organisation, module, revision, confMapping);
    this.artifacts.addAll(artifacts);
}
 
Example #27
Source File: DefaultIvyDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultIvyDependency(String organisation, String module, String revision, String confMapping, Collection<DependencyArtifact> artifacts) {
    this(organisation, module, revision, confMapping);
    this.artifacts.addAll(artifacts);
}
 
Example #28
Source File: DefaultIvyDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Iterable<DependencyArtifact> getArtifacts() {
    return artifacts;
}
 
Example #29
Source File: DefaultMavenDependency.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenDependency(String groupId, String artifactId, String version, Collection<DependencyArtifact> artifacts) {
    this(groupId, artifactId, version);
    this.artifacts.addAll(artifacts);
}
 
Example #30
Source File: DefaultMavenDependency.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenDependency(String groupId, String artifactId, String version, Collection<DependencyArtifact> artifacts) {
    this(groupId, artifactId, version);
    this.artifacts.addAll(artifacts);
}