Search in sources :

Example 1 with CloudSdkService

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

the class AppEngineStandardRunTask method execute.

@Override
public void execute(ProcessStartListener startListener) {
    CloudSdkService sdkService = CloudSdkService.getInstance();
    // show a warning notification if the cloud sdk version is not supported
    CloudSdkVersionNotifier.getInstance().notifyIfUnsupportedVersion();
    CloudSdk.Builder sdkBuilder = new CloudSdk.Builder().sdkPath(sdkService.getSdkHomePath()).async(true).startListener(startListener);
    if (javaSdk.getHomePath() != null) {
        sdkBuilder.javaHome(Paths.get(javaSdk.getHomePath()));
    }
    CloudSdkAppEngineDevServer1 devServer = new CloudSdkAppEngineDevServer1(sdkBuilder.build());
    devServer.run(runConfig);
    UsageTrackerProvider.getInstance().trackEvent(GctTracking.APP_ENGINE_RUN).addMetadata(GctTracking.METADATA_LABEL_KEY, Strings.nullToEmpty(runnerId)).ping();
}
Also used : CloudSdkAppEngineDevServer1(com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDevServer1) CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) CloudSdk(com.google.cloud.tools.appengine.cloudsdk.CloudSdk)

Example 2 with CloudSdkService

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

the class AppEngineStandardSupportProviderTest method setupAppEngine.

private void setupAppEngine(AppEngineStandardLibraryPanel libraryPanel, Library library) {
    CloudSdkService sdkService = mock(CloudSdkService.class);
    CloudSdkServiceManager sdkServiceManager = mock(CloudSdkServiceManager.class);
    when(sdkServiceManager.getCloudSdkService()).thenReturn(sdkService);
    CloudSdkInternals mockSdkInternals = mock(CloudSdkInternals.class);
    when(mockSdkInternals.getLibraries()).thenReturn(new File[] {});
    CloudSdkInternals.setInstance(mockSdkInternals);
    MavenRepositoryLibraryDownloader libraryDownloader = mock(MavenRepositoryLibraryDownloader.class);
    when(libraryDownloader.downloadLibrary(any(Module.class), any(AppEngineStandardMavenLibrary.class))).thenReturn(library);
    MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    applicationContainer.unregisterComponent(CloudSdkService.class.getName());
    applicationContainer.registerComponentInstance(CloudSdkService.class.getName(), sdkService);
    applicationContainer.unregisterComponent(MavenRepositoryLibraryDownloader.class.getName());
    applicationContainer.registerComponentInstance(MavenRepositoryLibraryDownloader.class.getName(), libraryDownloader);
    FrameworkSupportInModuleConfigurable configurable = selectFramework(AppEngineStandardFrameworkType.ID);
    if (libraryPanel != null && configurable instanceof AppEngineSupportConfigurable) {
        ((AppEngineSupportConfigurable) configurable).setAppEngineStandardLibraryPanel(libraryPanel);
    }
    CloudSdkServiceUserSettings.getInstance().setCustomSdkPath(AppEngineCodeInsightTestCase.getSdkPath());
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) AppEngineSupportConfigurable(com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardSupportProvider.AppEngineSupportConfigurable) AppEngineStandardMavenLibrary(com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardMavenLibrary) CloudSdkInternals(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkInternals) CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) MavenRepositoryLibraryDownloader(com.google.cloud.tools.intellij.appengine.facet.standard.MavenRepositoryLibraryDownloader) Module(com.intellij.openapi.module.Module) FrameworkSupportInModuleConfigurable(com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable) CloudSdkServiceManager(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkServiceManager)

Example 3 with CloudSdkService

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

the class AppEngineStandardUltimateWebIntegration method getOrCreateAppServer.

private static ApplicationServer getOrCreateAppServer() {
    final CloudSdkService sdkService = CloudSdkService.getInstance();
    if (sdkService == null) {
        return null;
    }
    final AppEngineServerIntegration integration = AppEngineServerIntegration.getInstance();
    // There are no distinguishing features about the App Engine servers so just return
    // the first one found
    final List<ApplicationServer> servers = ApplicationServersManager.getInstance().getApplicationServers(integration);
    if (!servers.isEmpty()) {
        return servers.iterator().next();
    }
    return ApplicationServersManager.getInstance().createServer(integration, new JavaeePersistentData());
}
Also used : JavaeePersistentData(com.intellij.javaee.oss.server.JavaeePersistentData) CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) ApplicationServer(com.intellij.javaee.appServerIntegrations.ApplicationServer) AppEngineServerIntegration(com.google.cloud.tools.intellij.appengine.server.integration.AppEngineServerIntegration)

Example 4 with CloudSdkService

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

the class AppEngineServerModel method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    if (artifactPointer == null || artifactPointer.getArtifact() == null) {
        throw new RuntimeConfigurationError(GctBundle.message("appengine.run.server.artifact.missing"));
    }
    // do not check SDK if it supports dynamic install - the deployment runner will block itself
    // until installation is done.
    CloudSdkService cloudSdkService = CloudSdkService.getInstance();
    SdkStatus sdkStatus = cloudSdkService.getStatus();
    if (sdkStatus != SdkStatus.READY && !cloudSdkService.isInstallSupported()) {
        if (!CloudSdkValidator.getInstance().isValidCloudSdk()) {
            throw new RuntimeConfigurationError(GctBundle.message("appengine.run.server.sdk.misconfigured.panel.message"));
        }
    }
    if (ProjectRootManager.getInstance(commonModel.getProject()).getProjectSdk() == null) {
        throw new RuntimeConfigurationError(GctBundle.getString("appengine.run.server.nosdk"));
    }
}
Also used : CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) SdkStatus(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService.SdkStatus)

Example 5 with CloudSdkService

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

the class AppEngineGwtServer method patchParameters.

@Override
public void patchParameters(@NotNull JavaParameters parameters, String originalOutputDir, @NotNull GwtFacet gwtFacet) {
    final ParametersList programParameters = parameters.getProgramParametersList();
    programParameters.add("-server");
    programParameters.add("com.google.appengine.tools.development.gwt.AppEngineLauncher");
    final CloudSdkService sdkService = CloudSdkService.getInstance();
    CloudSdkInternals sdkInternals = CloudSdkInternals.getInstance();
    sdkInternals.patchJavaParametersForDevServer(parameters.getVMParametersList());
    // used (see IDEA-63068)
    if (sdkInternals.getLibraries() != null) {
        for (File jar : ArrayUtil.mergeArrays(sdkInternals.getLibraries(), sdkInternals.getJspLibraries())) {
            parameters.getClassPath().addFirst(FileUtil.toSystemIndependentName(jar.getAbsolutePath()));
        }
    }
    if (sdkInternals.getToolsApiJarFile() != null) {
        parameters.getClassPath().add(sdkInternals.getToolsApiJarFile());
    }
}
Also used : ParametersList(com.intellij.execution.configurations.ParametersList) CloudSdkInternals(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkInternals) CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) File(java.io.File)

Aggregations

CloudSdkService (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService)7 CloudSdkInternals (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkInternals)3 SdkStatus (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService.SdkStatus)2 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)2 MutablePicoContainer (org.picocontainer.MutablePicoContainer)2 CloudSdk (com.google.cloud.tools.appengine.cloudsdk.CloudSdk)1 CloudSdkAppEngineDevServer1 (com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDevServer1)1 UserSpecifiedPathDeploymentSource (com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource)1 AppEngineStandardMavenLibrary (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardMavenLibrary)1 AppEngineSupportConfigurable (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardSupportProvider.AppEngineSupportConfigurable)1 MavenRepositoryLibraryDownloader (com.google.cloud.tools.intellij.appengine.facet.standard.MavenRepositoryLibraryDownloader)1 CloudSdkServiceManager (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkServiceManager)1 CloudSdkValidationResult (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkValidationResult)1 AppEngineServerIntegration (com.google.cloud.tools.intellij.appengine.server.integration.AppEngineServerIntegration)1 ParametersList (com.intellij.execution.configurations.ParametersList)1 FrameworkSupportInModuleConfigurable (com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable)1 ApplicationServer (com.intellij.javaee.appServerIntegrations.ApplicationServer)1 JavaeePersistentData (com.intellij.javaee.oss.server.JavaeePersistentData)1 Module (com.intellij.openapi.module.Module)1 File (java.io.File)1