use of org.gradle.api.tasks.Upload in project gradle by gradle.
the class UploadRule method createUploadTask.
private Upload createUploadTask(String name, final Configuration configuration, final Project project) {
Upload upload = project.getTasks().create(name, Upload.class);
upload.setDescription("Uploads all artifacts belonging to " + configuration);
upload.setGroup(BasePlugin.UPLOAD_GROUP);
upload.setConfiguration(configuration);
upload.setUploadDescriptor(true);
upload.getConventionMapping().map("descriptorDestination", new Callable<File>() {
public File call() throws Exception {
return new File(project.getBuildDir(), "ivy.xml");
}
});
return upload;
}
use of org.gradle.api.tasks.Upload in project gradle by gradle.
the class MavenPlugin method configureInstall.
private void configureInstall(Project project) {
Upload installUpload = project.getTasks().create(INSTALL_TASK_NAME, Upload.class);
Configuration configuration = project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION);
installUpload.setConfiguration(configuration);
MavenRepositoryHandlerConvention repositories = new DslObject(installUpload.getRepositories()).getConvention().getPlugin(MavenRepositoryHandlerConvention.class);
repositories.mavenInstaller();
installUpload.setDescription("Installs the 'archives' artifacts into the local Maven repository.");
}
use of org.gradle.api.tasks.Upload in project build-info by JFrogDev.
the class TaskHelperConfigurations method setDefaultMavenDescriptor.
protected void setDefaultMavenDescriptor() {
// Flag to publish the Maven POM, but no pom file inputted, activate default Maven "install" task.
// if the project doesn't have the maven install task, warn
Project project = getProject();
TaskContainer tasks = project.getTasks();
Upload installTask = tasks.withType(Upload.class).findByName("install");
if (installTask == null) {
log.warn("Cannot publish pom for project '{}' since it does not contain the Maven " + "plugin install task and task '{}' does not specify a custom pom path.", new Object[] { project.getPath(), getPath() });
artifactoryTask.mavenDescriptor = null;
} else {
artifactoryTask.mavenDescriptor = new File(project.getConvention().getPlugin(MavenPluginConvention.class).getMavenPomDir(), "pom-default.xml");
dependsOn(installTask);
}
}
use of org.gradle.api.tasks.Upload in project build-info by JFrogDev.
the class TaskHelperConfigurations method setDefaultIvyDescriptor.
protected void setDefaultIvyDescriptor() {
Project project = getProject();
TaskContainer tasks = project.getTasks();
Configuration archiveConfig = project.getConfigurations().findByName(Dependency.ARCHIVES_CONFIGURATION);
if (archiveConfig == null) {
log.warn("Cannot publish Ivy descriptor if ivyDescriptor not set in task '{}' " + "and no '{}' configuration exists in project '{}'.", Dependency.ARCHIVES_CONFIGURATION, project.getPath());
} else {
// Flag to publish the Ivy XML file, but no ivy descriptor file inputted, activate default upload${configuration}.
// ATTENTION: Tasks not part of the execution graph have withType(Upload.class) false ?!? Need to check for type our self.
Task candidateUploadTask = tasks.findByName(archiveConfig.getUploadTaskName());
if (candidateUploadTask == null) {
log.warn("Cannot publish Ivy descriptor if ivyDescriptor not set in task '{}' " + "and task '{}' does not exist." + "\nAdding \"apply plugin: 'java'\" or any other plugin extending the 'base' plugin" + "will solve this issue.", new Object[] { getPath(), archiveConfig.getUploadTaskName() });
} else {
if (!(candidateUploadTask instanceof Upload)) {
log.warn("Cannot publish Ivy descriptor if ivyDescriptor not set in task '{}' " + "and task '{}' is not an Upload task." + "\nYou'll need to set publishIvy=false or provide a path to the ivy file to " + "publish to solve this issue.", new Object[] { getPath(), archiveConfig.getUploadTaskName() });
} else {
Upload uploadTask = (Upload) candidateUploadTask;
if (!uploadTask.isUploadDescriptor()) {
log.info("Forcing task '{}' to upload its Ivy descriptor (uploadDescriptor was false).", uploadTask.getPath());
uploadTask.setUploadDescriptor(true);
}
artifactoryTask.ivyDescriptor = uploadTask.getDescriptorDestination();
dependsOn(candidateUploadTask);
}
}
}
}
Aggregations