Java Code Examples for org.gradle.api.artifacts.PublishArtifact#getClassifier()

The following examples show how to use org.gradle.api.artifacts.PublishArtifact#getClassifier() . 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: DefaultArtifactPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addArtifact(Artifact artifact, File src) {
    throwExceptionIfArtifactOrSrcIsNull(artifact, src);
    PublishArtifact publishArtifact = new MavenArtifact(artifact, src);
    ArtifactKey artifactKey = new ArtifactKey(publishArtifact);
    if (this.artifacts.containsKey(artifactKey)) {
        throw new InvalidUserDataException(String.format("A POM cannot have multiple artifacts with the same type and classifier. Already have %s, trying to add %s.", this.artifacts.get(
                artifactKey), publishArtifact));
    }

    if (publishArtifact.getClassifier() != null) {
        addArtifact(publishArtifact);
        assignArtifactValuesToPom(artifact, pom, false);
        return;
    }

    if (this.artifact != null) {
        // Choose the 'main' artifact based on its type.
        if (!PACKAGING_TYPES.contains(artifact.getType())) {
            addArtifact(publishArtifact);
            return;
        }
        if (PACKAGING_TYPES.contains(this.artifact.getType())) {
            throw new InvalidUserDataException("A POM can not have multiple main artifacts. " + "Already have " + this.artifact + ", trying to add " + publishArtifact);
        }
        addArtifact(this.artifact);
    }

    this.artifact = publishArtifact;
    this.artifacts.put(artifactKey, publishArtifact);
    assignArtifactValuesToPom(artifact, pom, true);
}
 
Example 2
Source File: DefaultArtifactPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addArtifact(Artifact artifact, File src) {
    throwExceptionIfArtifactOrSrcIsNull(artifact, src);
    PublishArtifact publishArtifact = new MavenArtifact(artifact, src);
    ArtifactKey artifactKey = new ArtifactKey(publishArtifact);
    if (this.artifacts.containsKey(artifactKey)) {
        throw new InvalidUserDataException(String.format("A POM cannot have multiple artifacts with the same type and classifier. Already have %s, trying to add %s.", this.artifacts.get(
                artifactKey), publishArtifact));
    }

    if (publishArtifact.getClassifier() != null) {
        addArtifact(publishArtifact);
        assignArtifactValuesToPom(artifact, pom, false);
        return;
    }

    if (this.artifact != null) {
        // Choose the 'main' artifact based on its type.
        if (!PACKAGING_TYPES.contains(artifact.getType())) {
            addArtifact(publishArtifact);
            return;
        }
        if (PACKAGING_TYPES.contains(this.artifact.getType())) {
            throw new InvalidUserDataException("A POM can not have multiple main artifacts. " + "Already have " + this.artifact + ", trying to add " + publishArtifact);
        }
        addArtifact(this.artifact);
    }

    this.artifact = publishArtifact;
    this.artifacts.put(artifactKey, publishArtifact);
    assignArtifactValuesToPom(artifact, pom, true);
}
 
Example 3
Source File: DefaultArtifactPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addArtifact(Artifact artifact, File src) {
    throwExceptionIfArtifactOrSrcIsNull(artifact, src);
    PublishArtifact publishArtifact = new MavenArtifact(artifact, src);
    ArtifactKey artifactKey = new ArtifactKey(publishArtifact);
    if (this.artifacts.containsKey(artifactKey)) {
        throw new InvalidUserDataException(String.format("A POM cannot have multiple artifacts with the same type and classifier. Already have %s, trying to add %s.", this.artifacts.get(
                artifactKey), publishArtifact));
    }

    if (publishArtifact.getClassifier() != null) {
        addArtifact(publishArtifact);
        assignArtifactValuesToPom(artifact, pom, false);
        return;
    }

    if (this.artifact != null) {
        // Choose the 'main' artifact based on its type.
        if (!PACKAGING_TYPES.contains(artifact.getType())) {
            addArtifact(publishArtifact);
            return;
        }
        if (PACKAGING_TYPES.contains(this.artifact.getType())) {
            throw new InvalidUserDataException("A POM can not have multiple main artifacts. " + "Already have " + this.artifact + ", trying to add " + publishArtifact);
        }
        addArtifact(this.artifact);
    }

    this.artifact = publishArtifact;
    this.artifacts.put(artifactKey, publishArtifact);
    assignArtifactValuesToPom(artifact, pom, true);
}
 
Example 4
Source File: DefaultArtifactPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addArtifact(Artifact artifact, File src) {
    throwExceptionIfArtifactOrSrcIsNull(artifact, src);
    PublishArtifact publishArtifact = new MavenArtifact(artifact, src);
    ArtifactKey artifactKey = new ArtifactKey(publishArtifact);
    if (this.artifacts.containsKey(artifactKey)) {
        throw new InvalidUserDataException(String.format("A POM cannot have multiple artifacts with the same type and classifier. Already have %s, trying to add %s.", this.artifacts.get(
                artifactKey), publishArtifact));
    }

    if (publishArtifact.getClassifier() != null) {
        addArtifact(publishArtifact);
        assignArtifactValuesToPom(artifact, pom, false);
        return;
    }

    if (this.artifact != null) {
        // Choose the 'main' artifact based on its type.
        if (!PACKAGING_TYPES.contains(artifact.getType())) {
            addArtifact(publishArtifact);
            return;
        }
        if (PACKAGING_TYPES.contains(this.artifact.getType())) {
            throw new InvalidUserDataException("A POM can not have multiple main artifacts. " + "Already have " + this.artifact + ", trying to add " + publishArtifact);
        }
        addArtifact(this.artifact);
    }

    this.artifact = publishArtifact;
    this.artifacts.put(artifactKey, publishArtifact);
    assignArtifactValuesToPom(artifact, pom, true);
}
 
Example 5
Source File: DefaultArtifactPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArtifactKey(PublishArtifact artifact) {
    this.type = artifact.getType();
    this.classifier = artifact.getClassifier();
}
 
Example 6
Source File: DefaultArtifactPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArtifactKey(PublishArtifact artifact) {
    this.type = artifact.getType();
    this.classifier = artifact.getClassifier();
}
 
Example 7
Source File: DefaultArtifactPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArtifactKey(PublishArtifact artifact) {
    this.type = artifact.getType();
    this.classifier = artifact.getClassifier();
}
 
Example 8
Source File: DefaultArtifactPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArtifactKey(PublishArtifact artifact) {
    this.type = artifact.getType();
    this.classifier = artifact.getClassifier();
}