use of org.gradle.api.tasks.bundling.AbstractArchiveTask in project gradle by gradle.
the class PublishArtifactToFileBuildOutcomeTransformer method getTypeIdentifier.
private String getTypeIdentifier(PublishArtifact artifact) {
if (artifact instanceof ArchivePublishArtifact) {
ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
AbstractArchiveTask task = publishArtifact.getArchiveTask();
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 {
// The client may try to infer from the file extension.
return UNKNOWN_ARTIFACT.getTypeIdentifier();
}
}
use of org.gradle.api.tasks.bundling.AbstractArchiveTask in project spring-boot by spring-projects.
the class AbstractBootArchiveTests method configure.
private T configure(T task) throws IOException {
AbstractArchiveTask archiveTask = task;
archiveTask.getArchiveBaseName().set("test");
File destination = new File(this.temp, "destination");
destination.mkdirs();
archiveTask.getDestinationDirectory().set(destination);
return task;
}
use of org.gradle.api.tasks.bundling.AbstractArchiveTask in project gradle by gradle.
the class LazyPublishArtifact method getDelegate.
private PublishArtifactInternal getDelegate() {
if (delegate == null) {
Object value = provider.get();
if (value instanceof FileSystemLocation) {
FileSystemLocation location = (FileSystemLocation) value;
delegate = fromFile(location.getAsFile());
} else if (value instanceof File) {
delegate = fromFile((File) value);
} else if (value instanceof AbstractArchiveTask) {
delegate = new ArchivePublishArtifact((AbstractArchiveTask) value);
} else if (value instanceof Task) {
delegate = fromFile(((Task) value).getOutputs().getFiles().getSingleFile());
} else if (fileResolver != null) {
delegate = fromFile(fileResolver.resolve(value));
} else {
throw new InvalidUserDataException(String.format("Cannot convert provided value (%s) to a file.", value));
}
}
return delegate;
}
Aggregations