use of com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource in project intellij-community by JetBrains.
the class CloudModuleDeploymentRuntimeProviderBase method createDeploymentRuntime.
@Override
public CloudDeploymentRuntime createDeploymentRuntime(DeploymentSource source, CloudMultiSourceServerRuntimeInstance serverRuntime, DeploymentTask<? extends CloudDeploymentNameConfiguration> deploymentTask, DeploymentLogManager logManager) throws ServerRuntimeException {
if (!(source instanceof ModuleDeploymentSource)) {
return null;
}
ModuleDeploymentSource moduleSource = (ModuleDeploymentSource) source;
Module module = moduleSource.getModule();
if (module == null) {
throw new ServerRuntimeException("Module not found: " + moduleSource.getModulePointer().getModuleName());
}
File contentRootFile = source.getFile();
LOG.assertTrue(contentRootFile != null, "Content root file is not found");
return doCreateDeploymentRuntime(moduleSource, contentRootFile, serverRuntime, deploymentTask, logManager);
}
use of com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource in project intellij-community by JetBrains.
the class CloudGitDeploymentChecker method checkGitUrl.
public void checkGitUrl(final RemoteServer<SC> server, final DeploymentSource deploymentSource, final T settings) throws RuntimeConfigurationException {
if (!(deploymentSource instanceof ModuleDeploymentSource)) {
return;
}
ModuleDeploymentSource moduleSource = (ModuleDeploymentSource) deploymentSource;
Module module = moduleSource.getModule();
if (module == null) {
return;
}
File contentRootFile = deploymentSource.getFile();
if (contentRootFile == null) {
return;
}
final Project project = module.getProject();
VirtualFile contentRoot = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(contentRootFile);
if (contentRoot == null) {
return;
}
GitRepository repository = GitUtil.getRepositoryManager(project).getRepositoryForRoot(contentRoot);
if (repository == null) {
return;
}
String expectedName = settings.getDeploymentSourceName(deploymentSource);
List<String> appNames = myDetector.collectApplicationNames(repository);
if (appNames.isEmpty() || appNames.contains(expectedName)) {
return;
}
RuntimeConfigurationWarning warning = new RuntimeConfigurationWarning("Cloud Git URL found in repository, but it doesn't match the run configuration");
warning.setQuickFix(() -> {
CloudGitApplication application = new CloudConnectionTask<CloudGitApplication, SC, T, SR>(project, "Searching for application", server) {
@Override
protected CloudGitApplication run(SR serverRuntime) throws ServerRuntimeException {
CloudGitDeploymentRuntime deploymentRuntime = (CloudGitDeploymentRuntime) serverRuntime.createDeploymentRuntime(deploymentSource, settings, project);
return deploymentRuntime.findApplication4Repository();
}
}.performSync();
if (application == null) {
Messages.showErrorDialog(project, "No application matching repository URL(s) found in account", server.getName());
} else {
settings.setDefaultDeploymentName(false);
settings.setDeploymentName(application.getName());
}
});
throw warning;
}
use of com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource 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;
}
Aggregations