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;
}
Aggregations