Search in sources :

Example 1 with AppEngineArtifactDeploymentSource

use of com.google.cloud.tools.intellij.appengine.cloud.AppEngineArtifactDeploymentSource in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineUtil method createArtifactDeploymentSources.

/**
 * Creates a list of artifact deployment sources available for deployment to App Engine.
 *
 * <p>Artifacts either target the standard or the flexible environment. All standard artifacts are
 * added. Flexible artifacts are only added if there are no other standard artifacts associated
 * with the same module.
 *
 * @return a list of {@link AppEngineArtifactDeploymentSource}
 */
public static List<AppEngineArtifactDeploymentSource> createArtifactDeploymentSources(@NotNull final Project project) {
    List<AppEngineArtifactDeploymentSource> sources = Lists.newArrayList();
    AppEngineProjectService projectService = AppEngineProjectService.getInstance();
    for (Module module : ModuleManager.getInstance(project).getModules()) {
        FacetManager facetManager = FacetManager.getInstance(module);
        if (facetManager.getFacetByType(AppEngineStandardFacetType.ID) != null || facetManager.getFacetByType(AppEngineFlexibleFacetType.ID) != null) {
            final AppEngineEnvironment environment = projectService.getModuleAppEngineEnvironment(module).orElseThrow(() -> new RuntimeException("No environment."));
            Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module);
            sources.addAll(artifacts.stream().filter(artifact -> doesArtifactMatchEnvironment(artifact, environment)).map(artifact -> AppEngineUtil.createArtifactDeploymentSource(project, artifact, environment)).collect(toList()));
        }
    }
    return sources;
}
Also used : ModulePointer(com.intellij.openapi.module.ModulePointer) AppEngineStandardFacetType(com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardFacetType) ModuleManager(com.intellij.openapi.module.ModuleManager) AppEngineProjectService(com.google.cloud.tools.intellij.appengine.project.AppEngineProjectService) Artifact(com.intellij.packaging.artifacts.Artifact) Lists(com.google.common.collect.Lists) ModuleDeploymentSource(com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource) Project(com.intellij.openapi.project.Project) ModuleType(com.intellij.openapi.module.ModuleType) Module(com.intellij.openapi.module.Module) AppEngineFlexibleFacetType(com.google.cloud.tools.intellij.appengine.facet.flexible.AppEngineFlexibleFacetType) JavaModuleType(com.intellij.openapi.module.JavaModuleType) AppEngineArtifactDeploymentSource(com.google.cloud.tools.intellij.appengine.cloud.AppEngineArtifactDeploymentSource) Collection(java.util.Collection) FacetManager(com.intellij.facet.FacetManager) ArtifactPointerManager(com.intellij.packaging.artifacts.ArtifactPointerManager) ModulePointerManager(com.intellij.openapi.module.ModulePointerManager) Nullable(org.jetbrains.annotations.Nullable) Collectors.toList(java.util.stream.Collectors.toList) UserSpecifiedPathDeploymentSource(com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource) List(java.util.List) ArtifactUtil(com.intellij.packaging.impl.artifacts.ArtifactUtil) MavenBuildDeploymentSource(com.google.cloud.tools.intellij.appengine.cloud.MavenBuildDeploymentSource) NotNull(org.jetbrains.annotations.NotNull) AppEngineEnvironment(com.google.cloud.tools.intellij.appengine.cloud.AppEngineEnvironment) AppEngineProjectService(com.google.cloud.tools.intellij.appengine.project.AppEngineProjectService) AppEngineArtifactDeploymentSource(com.google.cloud.tools.intellij.appengine.cloud.AppEngineArtifactDeploymentSource) AppEngineEnvironment(com.google.cloud.tools.intellij.appengine.cloud.AppEngineEnvironment) Module(com.intellij.openapi.module.Module) FacetManager(com.intellij.facet.FacetManager) Artifact(com.intellij.packaging.artifacts.Artifact)

Aggregations

AppEngineArtifactDeploymentSource (com.google.cloud.tools.intellij.appengine.cloud.AppEngineArtifactDeploymentSource)1 AppEngineEnvironment (com.google.cloud.tools.intellij.appengine.cloud.AppEngineEnvironment)1 MavenBuildDeploymentSource (com.google.cloud.tools.intellij.appengine.cloud.MavenBuildDeploymentSource)1 UserSpecifiedPathDeploymentSource (com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource)1 AppEngineFlexibleFacetType (com.google.cloud.tools.intellij.appengine.facet.flexible.AppEngineFlexibleFacetType)1 AppEngineStandardFacetType (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardFacetType)1 AppEngineProjectService (com.google.cloud.tools.intellij.appengine.project.AppEngineProjectService)1 Lists (com.google.common.collect.Lists)1 FacetManager (com.intellij.facet.FacetManager)1 JavaModuleType (com.intellij.openapi.module.JavaModuleType)1 Module (com.intellij.openapi.module.Module)1 ModuleManager (com.intellij.openapi.module.ModuleManager)1 ModulePointer (com.intellij.openapi.module.ModulePointer)1 ModulePointerManager (com.intellij.openapi.module.ModulePointerManager)1 ModuleType (com.intellij.openapi.module.ModuleType)1 Project (com.intellij.openapi.project.Project)1 Artifact (com.intellij.packaging.artifacts.Artifact)1 ArtifactPointerManager (com.intellij.packaging.artifacts.ArtifactPointerManager)1 ArtifactUtil (com.intellij.packaging.impl.artifacts.ArtifactUtil)1 ModuleDeploymentSource (com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource)1