本文整理匯總了Java中org.gradle.api.tasks.Upload類的典型用法代碼示例。如果您正苦於以下問題:Java Upload類的具體用法?Java Upload怎麽用?Java Upload使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Upload類屬於org.gradle.api.tasks包,在下文中一共展示了Upload類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: extract
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
public String extract() {
Collection<Upload> tasks = project.getTasks().withType(Upload.class);
Collection<ArtifactRepository> repositories = getRepositories(tasks);
if (!onlyContainsMavenResolvers(repositories)) {
return project.getName();
}
Collection<MavenDeployer> deployers = getMavenDeployers(repositories);
Set<String> artifactIds = getArtifactIds(deployers);
if (artifactIds.size() == 1) {
String artifactId = artifactIds.iterator().next();
if (artifactId != null && !artifactId.equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID)) {
return artifactId;
}
}
String baseName = getArchivesBaseName();
return baseName != null ? baseName : project.getName();
}
示例2: configureUploadArchivesTask
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private void configureUploadArchivesTask() {
configurationActionContainer.add(new Action<Project>() {
public void execute(Project project) {
Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME);
if (uploadArchives == null) {
return;
}
ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
Module module = configuration.getModule();
for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
MavenPom pom = resolver.getPom();
ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
);
publicationRegistry.registerPublication(project.getPath(), new DefaultProjectPublication(publicationId));
}
}
});
}
示例3: configureUploadArchivesTask
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private void configureUploadArchivesTask() {
configurationActionContainer.add(new Action<Project>() {
public void execute(Project project) {
Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(UPLOAD_ARCHIVES_TASK_NAME);
if (uploadArchives == null) {
return;
}
boolean hasIvyRepo = !uploadArchives.getRepositories().withType(IvyArtifactRepository.class).isEmpty();
if (!hasIvyRepo) {
return;
} // Maven repos are handled by MavenPlugin
ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
Module module = configuration.getModule();
ModuleVersionIdentifier publicationId =
new DefaultModuleVersionIdentifier(module.getGroup(), module.getName(), module.getVersion());
publicationRegistry.registerPublication(module.getProjectPath(), new DefaultProjectPublication(publicationId));
}
});
}
示例4: extract
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
public String extract() {
Collection<Upload> tasks = project.getTasks().withType(Upload.class);
Collection<ArtifactRepository> repositories = getRepositories(tasks);
if (!onlyContainsMavenResolvers(repositories)) { return project.getName(); }
Collection<MavenDeployer> deployers = getMavenDeployers(repositories);
Set<String> artifactIds = getArtifactIds(deployers);
if (artifactIds.size() == 1) {
String artifactId = artifactIds.iterator().next();
if (artifactId != null && !artifactId.equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID)) {
return artifactId;
}
}
String baseName = getArchivesBaseName();
return baseName != null ? baseName : project.getName();
}
示例5: configureUploadArchivesTask
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private void configureUploadArchivesTask() {
configurationActionContainer.add(new Action<Project>() {
public void execute(Project project) {
Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME);
if (uploadArchives == null) { return; }
ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
ModuleInternal module = configuration.getModule();
for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
MavenPom pom = resolver.getPom();
ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
);
publicationRegistry.registerPublication(project.getPath(), new DefaultProjectPublication(publicationId));
}
}
});
}
示例6: configureUploadArchivesTask
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private void configureUploadArchivesTask() {
configurationActionContainer.add(new Action<Project>() {
public void execute(Project project) {
Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(UPLOAD_ARCHIVES_TASK_NAME);
if (uploadArchives == null) { return; }
boolean hasIvyRepo = !uploadArchives.getRepositories().withType(IvyArtifactRepository.class).isEmpty();
if (!hasIvyRepo) { return; } // Maven repos are handled by MavenPlugin
ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
ModuleInternal module = configuration.getModule();
ModuleVersionIdentifier publicationId =
new DefaultModuleVersionIdentifier(module.getGroup(), module.getName(), module.getVersion());
publicationRegistry.registerPublication(module.getProjectPath(), new DefaultProjectPublication(publicationId));
}
});
}
示例7: getRepositories
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private Collection<ArtifactRepository> getRepositories(Collection<Upload> tasks) {
Collection<ArtifactRepository> result = Lists.newArrayList();
for (Upload task : tasks) {
result.addAll(task.getRepositories());
}
return result;
}
示例8: configureUploadTasks
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private void configureUploadTasks(final DefaultDeployerFactory deployerFactory) {
project.getTasks().withType(Upload.class, new Action<Upload>() {
public void execute(Upload upload) {
RepositoryHandler repositories = upload.getRepositories();
DefaultRepositoryHandler handler = (DefaultRepositoryHandler) repositories;
DefaultMavenRepositoryHandlerConvention repositoryConvention = new DefaultMavenRepositoryHandlerConvention(handler, deployerFactory);
new DslObject(repositories).getConvention().getPlugins().put("maven", repositoryConvention);
}
});
}
示例9: configureInstall
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
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.");
}
示例10: createUploadTask
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
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;
}
示例11: setupDefaultConfig
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
public static void setupDefaultConfig(
@NonNull final Project project,
@NonNull Configuration configuration) {
// The library artifact is published (inter-project( for the "default" configuration so
// we make sure "default" extends from the actual configuration used for building.
Configuration defaultConfig = project.getConfigurations().getAt("default");
defaultConfig.setExtendsFrom(Collections.singleton(configuration));
// for the maven publication (for now), we need to manually include all the configuration
// object in a special mapping.
// It's not possible to put the top level config object as extended from config won't
// be included.
final Set<Configuration> flattenedConfigs = flattenConfigurations(configuration);
project.getPlugins().withType(MavenPlugin.class, new Action<MavenPlugin>() {
@Override
public void execute(MavenPlugin mavenPlugin) {
project.getTasks().withType(Upload.class, new Action<Upload>() {
@Override
public void execute(Upload upload) {
upload.getRepositories().withType(
MavenDeployer.class,
new Action<MavenDeployer>() {
@Override
public void execute(MavenDeployer mavenDeployer) {
for (Configuration config : flattenedConfigs) {
mavenDeployer.getPom().getScopeMappings().addMapping(
300,
project.getConfigurations().getByName(
config.getName()),
"compile");
}
}
});
}
});
}
});
}
示例12: createUploadTask
import org.gradle.api.tasks.Upload; //導入依賴的package包/類
private Upload createUploadTask(String name, final Configuration configuration, final Project project) {
Upload upload = project.getTasks().create(name, Upload.class);
upload.setDescription(String.format("Uploads all artifacts belonging to %s", 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;
}