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();
}
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());
}
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());
}
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"));
}
}
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());
}
}
Aggregations