Java Code Examples for org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact#getArchiveTask()

The following examples show how to use org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact#getArchiveTask() . 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: PublishArtifactToFileBuildOutcomeTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example 2
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example 3
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example 4
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}