Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

plugins {
id "org.jetbrains.intellij" version "1.9.0"
id "org.jetbrains.intellij" version "1.13.2"
}

repositories {
Expand All @@ -16,13 +16,13 @@ apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
apply plugin: 'jacoco'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
sourceCompatibility = '11'
targetCompatibility = '11'

intellij {
version = ideaVersion //for a full list of IntelliJ IDEA releases please see https://www.jetbrains.com/intellij-repository/releases
pluginName = 'org.jboss.tools.intellij.analytics'
plugins = ['com.redhat.devtools.intellij.telemetry:0.0.2.18']
plugins = ['com.redhat.devtools.intellij.telemetry:0.0.3.33']
updateSinceUntilBuild = false
}

Expand All @@ -36,8 +36,8 @@ publishPlugin {
}

dependencies {
implementation 'com.github.ballerina-platform:lsp4intellij:master-SNAPSHOT'
implementation 'org.kohsuke:github-api:1.306'
implementation 'com.github.ballerina-platform:lsp4intellij:0.95.1'
implementation 'org.kohsuke:github-api:1.314'
implementation 'org.apache.commons:commons-compress:1.21'
testImplementation('junit:junit:4.13.1')
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.File;
import java.io.IOException;

import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.util.io.HttpRequests;
import com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage;
import com.intellij.openapi.diagnostic.Logger;
Expand Down Expand Up @@ -36,7 +36,7 @@ private boolean isNewRelease(final String releaseLabel) {
}


public File download(final ProgressIndicator indicator) throws IOException {
public File download() throws IOException {
final ActionMessage telemetry;
final String latestReleaseTag;
final File dest = new File(Platform.pluginDirectory, fileName);
Expand Down Expand Up @@ -72,7 +72,7 @@ public File download(final ProgressIndicator indicator) throws IOException {
HttpRequests
.request(url)
.productNameAsUserAgent()
.saveToFile(dest, indicator);
.saveToFile(dest, ProgressManager.getGlobalProgressIndicator());

dest.setExecutable(true);
cookies.setValue(cookieName, latestReleaseTag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class Platform {
PluginId.getId("org.jboss.tools.intellij.analytics")).getPluginPath().toAbsolutePath().toString();

// Set LSP and CLI tarballs to be downloaded, CLI version is pinned to last stable version instead of latest.
private static final Platform WINDOWS = new Platform("analytics-lsp-win.exe", "crda_0.2.4_Windows_64bit.tar.gz");
private static final Platform LINUX = new Platform("analytics-lsp-linux", "crda_0.2.4_Linux_64bit.tar.gz");
private static final Platform MACOS = new Platform("analytics-lsp-macos", "crda_0.2.4_macOS_64bit.tar.gz");
private static final Platform WINDOWS = new Platform("analytics-lsp-win.exe", "crda_0.2.5_Windows_64bit.tar.gz");
private static final Platform LINUX = new Platform("analytics-lsp-linux", "crda_0.2.5_Linux_64bit.tar.gz");
private static final Platform MACOS = new Platform("analytics-lsp-macos", "crda_0.2.5_macOS_64bit.tar.gz");

public String lspBundleName;
public String cliTarBallName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import java.io.IOException;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PreloadingActivity;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity;
import org.jetbrains.annotations.NotNull;
import org.wso2.lsp4intellij.IntellijLanguageClient;

public final class PreloadLanguageServer extends PreloadingActivity {
public final class PreloadLanguageServer implements StartupActivity.Background {
private static final Logger log = Logger.getInstance(PreloadLanguageServer.class);
private final ICookie cookies = ServiceManager.getService(Settings.class);

Expand All @@ -27,23 +28,27 @@ private void attachLanguageClient(final File cliFile) {
}

@Override
public void preload(ProgressIndicator indicator) {
public void runActivity(@NotNull Project project) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
log.debug("lsp preload called");

log.info("lsp preload called");

try {
final String devUrl = System.getenv("ANALYTICS_LSP_FILE_PATH");
File lspBundle;
if (devUrl != null) {
lspBundle = new File(devUrl);
} else {
final GitHubReleaseDownloader bundle = new GitHubReleaseDownloader(
Platform.current.lspBundleName,
cookies,
"fabric8-analytics/fabric8-analytics-lsp-server",
false);
lspBundle = bundle.download(indicator);
Platform.current.lspBundleName,
cookies,
"fabric8-analytics/fabric8-analytics-lsp-server",
false);
lspBundle = bundle.download();

log.info("lsp binary is ready for use.");
}
attachLanguageClient(lspBundle);
} catch(IOException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@State(
name = "Settings",
storages = {
@Storage(file = "analytics.settings.xml", roamingType = RoamingType.DISABLED)
@Storage(value = "analytics.settings.xml", roamingType = RoamingType.DISABLED)
})
public final class Settings implements ICookie, PersistentStateComponent<Settings> {

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jboss/tools/intellij/stackanalysis/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class Cli {
public String cliReleaseTag;

// Set name of CLI binary and release tag
private static final Cli WINDOWS = new Cli("crda.exe", "v0.2.4");
private static final Cli LINUX = new Cli("crda", "v0.2.4");
private static final Cli MACOS = new Cli("crda", "v0.2.4");
private static final Cli WINDOWS = new Cli("crda.exe", "v0.2.5");
private static final Cli LINUX = new Cli("crda", "v0.2.5");
private static final Cli MACOS = new Cli("crda", "v0.2.5");

private Cli(String cliBinaryName, String cliReleaseTag) {
this.cliBinaryName = cliBinaryName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
package org.jboss.tools.intellij.stackanalysis;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PreloadingActivity;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity;
import org.jboss.tools.intellij.analytics.GitHubReleaseDownloader;
import org.jboss.tools.intellij.analytics.ICookie;
import org.jboss.tools.intellij.analytics.Platform;
Expand All @@ -24,23 +24,16 @@

import java.io.IOException;


public final class PreloadCli extends PreloadingActivity {
public final class PreloadCli implements StartupActivity.Background {
private static final Logger logger = Logger.getInstance(PreloadCli.class);
private final ICookie cookies = ServiceManager.getService(Settings.class);

/**
* <p> Activity need to be performed when plugin/IDE is started.</p>
*
* When IDE is started or plugin is installed setup prerequisites for plugin.
*
* @param indicator An object of ProgressIndicator
*/
@Override
public void preload(@NotNull ProgressIndicator indicator) {
public void runActivity(@NotNull Project project) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}

logger.info("CLI preload is called");

try {
Expand All @@ -50,13 +43,13 @@ public void preload(@NotNull ProgressIndicator indicator) {
// If Env variable is not set download binary from GitHub Repo
if (cliPath == null) {
final GitHubReleaseDownloader bundle = new GitHubReleaseDownloader(
Platform.current.cliTarBallName,
cookies,
"fabric8-analytics/cli-tools",
true);
Platform.current.cliTarBallName,
cookies,
"fabric8-analytics/cli-tools",
true);

// Download the CLI tarball
bundle.download(indicator);
bundle.download();

// Extract tar file to get CLI Binary
new SaUtils().unTarBundle(Platform.current.cliTarBallName, Cli.current.cliBinaryName);
Expand Down
32 changes: 23 additions & 9 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,24 @@
<depends>com.redhat.devtools.intellij.telemetry</depends>

<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="org.jboss.tools.intellij.analytics.PreloadLanguageServer"/>
<postStartupActivity implementation="org.jboss.tools.intellij.stackanalysis.PreloadCli"/>
<!-- register intellijLanguageClient as a Service -->
<applicationService serviceImplementation="org.wso2.lsp4intellij.IntellijLanguageClient"/>
<!-- register a listener on editor events, required for lsp file sync -->
<editorFactoryListener implementation="org.wso2.lsp4intellij.listeners.LSPEditorListener"/>
<fileDocumentManagerListener implementation="org.wso2.lsp4intellij.listeners.LSPFileDocumentManagerListener"/>
<!-- for displaying notifications by lsp -->
<notificationGroup id="lsp" displayType="STICKY_BALLOON"/>
<!-- for displaying the statusbar lsp icon -->
<statusBarWidgetFactory implementation="org.wso2.lsp4intellij.statusbar.LSPServerStatusWidgetFactory"
id="org.wso2.lsp4intellij.statusbar.LSPServerStatusWidgetFactory"
order="first" />
<!-- needed for code diagnostics by lsp -->
<externalAnnotator id="LSPAnnotator-xml" language="XML" implementationClass="org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator"/>
<externalAnnotator id="LSPAnnotator-json" language="JSON" implementationClass="org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator"/>
<externalAnnotator id="LSPAnnotator-txt" language="TEXT" implementationClass="org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator"/>
<preloadingActivity implementation="org.jboss.tools.intellij.analytics.PreloadLanguageServer"
id="org.jboss.tools.intellij.analytics.PostStartupActivity"/>
<preloadingActivity implementation="org.jboss.tools.intellij.stackanalysis.PreloadCli"
id="org.jboss.tools.intellij.analytics.PostStartupCliActivity"/>

<fileEditorProvider implementation="org.jboss.tools.intellij.stackanalysis.SaReportEditorProvider"/>
<editorTabTitleProvider implementation="org.jboss.tools.intellij.stackanalysis.SaEditorTabTitleProvider" order="first"/>
</extensions>
Expand All @@ -148,9 +159,12 @@
</group>
</actions>

<application-components>
<component>
<implementation-class>org.wso2.lsp4intellij.IntellijLanguageClient</implementation-class>
</component>
</application-components>
<applicationListeners>
<!-- required for lsp file sync -->
<listener class="org.wso2.lsp4intellij.listeners.VFSListener"
topic="com.intellij.openapi.vfs.VirtualFileListener"/>
<listener class="org.wso2.lsp4intellij.listeners.LSPProjectManagerListener"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
</applicationListeners>

</idea-plugin>