use of com.google.cloud.tools.intellij.appengine.cloud.AppEngineEnvironment 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;
}
use of com.google.cloud.tools.intellij.appengine.cloud.AppEngineEnvironment in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineUtil method createModuleDeploymentSources.
/**
* Creates a list of module deployment sources available for deployment to App Engine:
*
* <p>Maven based deployment sources are included for both flexible and standard projects if
* applicable.
*
* <p>User browsable jar/war deployment sources are included only if there are no App Engine
* standard modules.
*
* @return a list of {@link ModuleDeploymentSource}'s
*/
public static List<ModuleDeploymentSource> createModuleDeploymentSources(@NotNull Project project) {
AppEngineProjectService projectService = AppEngineProjectService.getInstance();
List<ModuleDeploymentSource> moduleDeploymentSources = Lists.newArrayList();
boolean hasStandardModules = false;
for (Module module : ModuleManager.getInstance(project).getModules()) {
FacetManager facetManager = FacetManager.getInstance(module);
if (facetManager.getFacetByType(AppEngineStandardFacetType.ID) != null || facetManager.getFacetByType(AppEngineFlexibleFacetType.ID) != null) {
AppEngineEnvironment environment = projectService.getModuleAppEngineEnvironment(module).orElseThrow(() -> new RuntimeException("No environment."));
if (ModuleType.is(module, JavaModuleType.getModuleType()) && projectService.isJarOrWarMavenBuild(module)) {
moduleDeploymentSources.add(createMavenBuildDeploymentSource(project, module, environment));
}
if (environment.isStandard() || environment.isFlexCompat()) {
hasStandardModules = true;
}
}
}
if (!hasStandardModules) {
moduleDeploymentSources.add(createUserSpecifiedPathDeploymentSource(project));
}
return moduleDeploymentSources;
}
use of com.google.cloud.tools.intellij.appengine.cloud.AppEngineEnvironment in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineStandardDeploymentEditorTest method resetEditorFrom_doesSetEnvironment.
@Test
public void resetEditorFrom_doesSetEnvironment() {
AppEngineEnvironment environment = AppEngineEnvironment.APP_ENGINE_FLEX_COMPAT;
configuration.setEnvironment(environment);
editor.resetEditorFrom(configuration);
assertThat(editor.getCommonConfig().getEnvironmentLabel().getText()).isEqualTo(environment.localizedLabel());
}
Aggregations