Java Code Examples for org.gradle.api.internal.artifacts.ivyservice.projectmodule.DefaultProjectPublication

The following examples show how to use org.gradle.api.internal.artifacts.ivyservice.projectmodule.DefaultProjectPublication. These examples are extracted from open source projects. 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 Project: pushfish-android   Author: PushFish   File: MavenPlugin.java    License: 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 Project: pushfish-android   Author: PushFish   File: BasePlugin.java    License: 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 #3
Source Project: pushfish-android   Author: PushFish   File: MavenPlugin.java    License: 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 #4
Source Project: pushfish-android   Author: PushFish   File: BasePlugin.java    License: 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 #5
Source Project: javaide   Author: tranleduy2000   File: BasePlugin.java    License: 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 Project: Pushjet-Android   Author: Pushjet   File: MavenPlugin.java    License: 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 #7
Source Project: Pushjet-Android   Author: Pushjet   File: BasePlugin.java    License: 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 Project: Pushjet-Android   Author: Pushjet   File: MavenPlugin.java    License: 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 #9
Source Project: Pushjet-Android   Author: Pushjet   File: BasePlugin.java    License: 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 #10
Source Project: pushfish-android   Author: PushFish   File: PublishingPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
void addConfiguredPublicationsToProjectPublicationRegistry(ProjectPublicationRegistry projectPublicationRegistry, PublishingExtension extension, ProjectIdentifier projectIdentifier) {
    for (Publication publication : extension.getPublications()) {
        PublicationInternal internalPublication = (PublicationInternal) publication;
        projectPublicationRegistry.registerPublication(projectIdentifier.getPath(), new DefaultProjectPublication(internalPublication.getCoordinates()));
    }
}
 
Example #11
Source Project: Pushjet-Android   Author: Pushjet   File: PublishingPlugin.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
void addConfiguredPublicationsToProjectPublicationRegistry(ProjectPublicationRegistry projectPublicationRegistry, PublishingExtension extension, ProjectIdentifier projectIdentifier) {
    for (Publication publication : extension.getPublications()) {
        PublicationInternal internalPublication = (PublicationInternal) publication;
        projectPublicationRegistry.registerPublication(projectIdentifier.getPath(), new DefaultProjectPublication(internalPublication.getCoordinates()));
    }
}