org.gradle.api.tasks.Upload Java Examples

The following examples show how to use org.gradle.api.tasks.Upload. 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: MavenPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
            }
        }
    });
}
 
Example #2
Source File: MavenPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
            }
        }
    });
}
 
Example #3
Source File: ProjectDependencyArtifactIdExtractorHack.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example #4
Source File: ProjectDependencyArtifactIdExtractorHack.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example #5
Source File: BasePlugin.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
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));
        }
    });
}
 
Example #6
Source File: BasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
        }
    });
}
 
Example #7
Source File: BasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
        }
    });
}
 
Example #8
Source File: ProjectDependencyArtifactIdExtractorHack.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example #9
Source File: ProjectDependencyArtifactIdExtractorHack.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example #10
Source File: BasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
        }
    });
}
 
Example #11
Source File: MavenPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
            }
        }
    });
}
 
Example #12
Source File: MavenPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
            }
        }
    });
}
 
Example #13
Source File: BasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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));
        }
    });
}
 
Example #14
Source File: MavenPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    });
}
 
Example #15
Source File: ProjectDependencyArtifactIdExtractorHack.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Collection<ArtifactRepository> getRepositories(Collection<Upload> tasks) {
    Collection<ArtifactRepository> result = Lists.newArrayList();
    for (Upload task : tasks) {
        result.addAll(task.getRepositories());
    }
    return result;
}
 
Example #16
Source File: VariantHelper.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
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");
                                    }
                                }
                            });
                }
            });
        }
    });
}
 
Example #17
Source File: MavenPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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.");
}
 
Example #18
Source File: UploadRule.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example #19
Source File: UploadRule.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example #20
Source File: MavenPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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.");
}
 
Example #21
Source File: MavenPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    });
}
 
Example #22
Source File: ProjectDependencyArtifactIdExtractorHack.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Collection<ArtifactRepository> getRepositories(Collection<Upload> tasks) {
    Collection<ArtifactRepository> result = Lists.newArrayList();
    for (Upload task : tasks) {
        result.addAll(task.getRepositories());
    }
    return result;
}
 
Example #23
Source File: UploadRule.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example #24
Source File: MavenPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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.");
}
 
Example #25
Source File: MavenPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    });
}
 
Example #26
Source File: ProjectDependencyArtifactIdExtractorHack.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Collection<ArtifactRepository> getRepositories(Collection<Upload> tasks) {
    Collection<ArtifactRepository> result = Lists.newArrayList();
    for (Upload task : tasks) {
        result.addAll(task.getRepositories());
    }
    return result;
}
 
Example #27
Source File: UploadRule.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example #28
Source File: MavenPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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.");
}
 
Example #29
Source File: MavenPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    });
}
 
Example #30
Source File: ProjectDependencyArtifactIdExtractorHack.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private Collection<ArtifactRepository> getRepositories(Collection<Upload> tasks) {
    Collection<ArtifactRepository> result = Lists.newArrayList();
    for (Upload task : tasks) {
        result.addAll(task.getRepositories());
    }
    return result;
}