Skip to content

Commit

Permalink
Merge pull request #164 from redhat-developer/feature/support-idea-20…
Browse files Browse the repository at this point in the history
…24.1.x

feat: support idea IJ Version 2024.1.x
  • Loading branch information
zvigrinberg authored Aug 13, 2024
2 parents 9f91237 + 3de2f9a commit c0e71fc
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/IJ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
IJ: [IC-2022.1]
IJ: [IC-2022.3]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Build with Gradle
run: >
./gradlew runPluginVerifier
-PideaVersion=IC-2022.1
-PideaVersion=IC-2022.3
-Pgpr.username=${{ github.actor }}
-Pgpr.token=${{ secrets.GITHUB_TOKEN }}
- name: Upload report
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
Expand All @@ -34,10 +34,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
Expand All @@ -53,10 +53,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

plugins {
id "org.jetbrains.intellij" version "1.15.0"
}
Expand Down Expand Up @@ -40,8 +39,8 @@ 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:1.1.0.52',
"org.jetbrains.plugins.go:221.5080.9",
"Docker:221.5080.9"]
"org.jetbrains.plugins.go:223.7571.182",
"Docker:223.7571.175"]
updateSinceUntilBuild = false
}

Expand All @@ -66,6 +65,9 @@ dependencies {
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
// https://mvnrepository.com/artifact/com.github.package-url/packageurl-java
implementation group: 'com.github.package-url', name: 'packageurl-java', version: '1.4.1'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.16.1'



testImplementation('junit:junit:4.13.1')
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ideaVersion = 2022.1
ideaVersion = 2022.3
projectVersion=1.1.0-SNAPSHOT
jetBrainsToken=invalid
jetBrainsChannel=stable
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.redhat.exhort.api.DependencyReport;
import com.redhat.exhort.api.ProviderReport;
import com.redhat.exhort.api.Source;
import org.apache.commons.io.FileUtils;
import org.jboss.tools.intellij.exhort.ApiService;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -73,9 +74,10 @@ public static boolean performAnalysis(String packageManager,
PsiFile file) {
if (dependenciesModified(filePath, dependencies)) {
Path tempManifest;
Path tempDirectory;
ApiService apiService = ServiceManager.getService(ApiService.class);
try {
Path tempDirectory = Files.createTempDirectory("rhda-idea");
tempDirectory = Files.createTempDirectory("rhda-idea");
tempManifest = Files.createFile(Path.of(tempDirectory.toString(),fileName));
Files.write(tempManifest,PsiDocumentManager.getInstance(file.getProject()).getCachedDocument(file).getText().getBytes());
} catch (IOException e) {
Expand All @@ -84,6 +86,7 @@ public static boolean performAnalysis(String packageManager,

// AnalysisReport report = apiService.getComponentAnalysis(packageManager, fileName, filePath);
AnalysisReport report = apiService.getComponentAnalysis(packageManager, fileName, tempManifest.toString());
deleteTempDir(tempDirectory);
if (report == null) {
throw new RuntimeException("Failed to perform component analysis, result is invalid.");
}
Expand Down Expand Up @@ -161,6 +164,13 @@ public static boolean performAnalysis(String packageManager,
return false;
}

private static void deleteTempDir(Path tempDirectory) {
try {
FileUtils.deleteDirectory(tempDirectory.toFile());
} catch (IOException e) {
LOG.warn("Failed to delete temp directory: " + tempDirectory, e);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
package org.jboss.tools.intellij.image;

import com.intellij.docker.dockerFile.DockerFileType;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.*;
import org.jetbrains.annotations.NotNull;

public class ImageReportAction extends AnAction {

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
var project = event.getProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
Expand Down Expand Up @@ -44,6 +45,11 @@ public SaAction() {

}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

/**
* <p>Intellij Plugin Action implementation for triggering SA.</p>
* <p>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
</change-notes>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="211.0"/>
<idea-version since-build="223.0"/>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
Expand Down

0 comments on commit c0e71fc

Please sign in to comment.