Search in sources :

Example 1 with CloudGitApplication

use of com.intellij.remoteServer.agent.util.CloudGitApplication in project intellij-community by JetBrains.

the class CloudGitDeploymentRuntime method deploy.

@Override
public CloudGitApplication deploy() throws ServerRuntimeException {
    CloudGitApplication application = findOrCreateApplication();
    deployApplication(application);
    return application;
}
Also used : CloudGitApplication(com.intellij.remoteServer.agent.util.CloudGitApplication)

Example 2 with CloudGitApplication

use of com.intellij.remoteServer.agent.util.CloudGitApplication 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;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CloudGitApplication(com.intellij.remoteServer.agent.util.CloudGitApplication) Project(com.intellij.openapi.project.Project) GitRepository(git4idea.repo.GitRepository) ModuleDeploymentSource(com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) Module(com.intellij.openapi.module.Module) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

CloudGitApplication (com.intellij.remoteServer.agent.util.CloudGitApplication)2 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ModuleDeploymentSource (com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource)1 GitRepository (git4idea.repo.GitRepository)1 File (java.io.File)1