Skip to content

Commit f85276c

Browse files
authored
Merge pull request #357 from SeeSharpSoft/main
Fix compatibility & updated build/publish process
2 parents e87bc8e + 4d2f64a commit f85276c

File tree

11 files changed

+100
-108
lines changed

11 files changed

+100
-108
lines changed

.github/workflows/CIBuild.yml

+53-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,61 @@
1-
# This workflow will build a Java project with Gradle
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3-
4-
name: CI Build
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "Build (main)"
513

614
on:
715
push:
816
branches: [ main ]
17+
schedule:
18+
- cron: '18 7 * * 6'
919

1020
jobs:
11-
build:
12-
21+
analyze:
22+
name: Analyze
1323
runs-on: ubuntu-latest
1424

25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
language: [ 'java' ]
29+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
30+
# Learn more:
31+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
32+
1533
steps:
16-
- uses: actions/checkout@v2
34+
- name: Checkout repository
35+
uses: actions/checkout@v2
36+
37+
# Initializes the CodeQL tools for scanning.
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@v2
40+
with:
41+
languages: ${{ matrix.language }}
42+
# If you wish to specify custom queries, you can do so here or in a config file.
43+
# By default, queries listed here will override any specified in a config file.
44+
# Prefix the list here with "+" to use these queries and those in the config file.
45+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
46+
47+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
48+
# If this step fails, then you should remove it and run the build manually (see below)
49+
# - name: Autobuild
50+
# uses: github/codeql-action/autobuild@v1
51+
52+
# ℹ️ Command-line programs to run using the OS shell.
53+
# 📚 https://git.io/JvXDl
54+
55+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
56+
# and modify them (or add more) to build your code if your project
57+
# uses a compiled language
58+
1759
- name: Set up JDK 17
1860
uses: actions/setup-java@v2
1961
with:
@@ -24,4 +66,7 @@ jobs:
2466
- name: Build with Gradle
2567
env:
2668
IDEA_SOURCES: false
27-
run: xvfb-run ./gradlew test
69+
run: xvfb-run ./gradlew build
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2

.github/workflows/PublishStable.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ jobs:
1212

1313
runs-on: ubuntu-latest
1414

15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- ideaVersion: 2022.2.1
20+
gkVersion: 2021.1.2
21+
- ideaVersion: LATEST-EAP-SNAPSHOT
22+
gkVersion: 2021.1.2
23+
1524
steps:
1625
- uses: actions/checkout@v2
1726
- name: Set up JDK 17
@@ -23,8 +32,8 @@ jobs:
2332
run: chmod +x gradlew
2433
- name: Build with Gradle
2534
env:
26-
IDEA_VERSION: IU-2022.1.1
27-
GRAMMAR_KIT_VERSION: 2021.1.2
35+
IDEA_VERSION: ${{ matrix.ideaVersion }}
36+
GRAMMAR_KIT_VERSION: ${{ matrix.gkVersion }}
2837
IDEA_SOURCES: false
2938
JI_CHANNELS: Stable
3039
JI_TOKEN: ${{ secrets.JI_TOKEN }}

.github/workflows/PullRequest.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
- ideaVersion: PY-2022.1.1
19+
- ideaVersion: 2022.2.1
20+
ideaType: PS
2021
gkVersion: 2021.1.2
21-
- ideaVersion: IC-2022.2.1
22+
- ideaVersion: 2022.2.3
23+
ideaType: PY
2224
gkVersion: 2021.1.2
2325

2426
steps:
@@ -33,6 +35,7 @@ jobs:
3335
- name: Build with Gradle
3436
env:
3537
IDEA_VERSION: ${{ matrix.ideaVersion }}
38+
IDEA_TYPE: ${{ matrix.ideaType }}
3639
GRAMMAR_KIT_VERSION: ${{ matrix.gkVersion }}
3740
IDEA_SOURCES: false
3841
run: xvfb-run ./gradlew test

.github/workflows/codeql-analysis.yml

-64
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# CSV Editor Plugin for JetBrains IDE family
99

10-
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2022.1 and newer__
10+
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2022.2 and newer__
1111

1212
This plugin introduces CSV (_Comma-Separated Values_) as a language to Jetbrains IDE with a syntax definition, structured language elements and associated file types (.csv/.tsv/.psv).
1313
This enables default editor features like syntax validation, highlighting and inspections for CSV-alike files.

build.gradle

+21-9
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ jacocoTestReport {
1919
}
2020

2121
group 'net.seesharpsoft.intellij.plugins'
22-
version '3.0.0'
2322

2423
apply plugin: 'java'
25-
project.sourceCompatibility = JavaVersion.VERSION_11
26-
project.targetCompatibility = JavaVersion.VERSION_11
24+
project.sourceCompatibility = JavaVersion.VERSION_17
25+
project.targetCompatibility = JavaVersion.VERSION_17
2726
tasks.withType(JavaCompile) {
2827
options.encoding = 'UTF-8'
2928
options.compilerArgs << "-Xlint:deprecation"
@@ -67,20 +66,33 @@ idea {
6766
}
6867
}
6968

69+
var final EAP_VERSION = 'LATEST-EAP-SNAPSHOT'
70+
var final EAP_BUILD = '223'
71+
72+
// IDE version - https://www.jetbrains.com/intellij-repository/releases
73+
var idea_version = System.getenv().getOrDefault('IDEA_VERSION', '2022.2.1')
74+
var build_version = idea_version == EAP_VERSION ? EAP_BUILD : idea_version.substring(2, 4) + idea_version.charAt(5) // extract e.g. '221' from '2022.1.1'
75+
76+
version '3.0.0-' + build_version
77+
7078
apply plugin: 'org.jetbrains.intellij'
7179
intellij {
72-
// IDE version - https://www.jetbrains.com/intellij-repository/releases
73-
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-2022.1.1')
74-
pluginName = 'CSV'
75-
updateSinceUntilBuild = false
80+
version = idea_version
81+
type = System.getenv().getOrDefault('IDEA_TYPE', 'IC')
82+
pluginName = 'CSVEditor'
83+
updateSinceUntilBuild = true
84+
sameSinceUntilBuild = true
7685
downloadSources = Boolean.parseBoolean(System.getenv().getOrDefault('IDEA_SOURCES', "true"))
7786

7887
plugins = [
79-
System.getenv().getOrDefault('GIT_PLUGIN_VERSION', 'Git4Idea'),
80-
System.getenv().getOrDefault('GITHUB_PLUGIN_VERSION', 'org.jetbrains.plugins.github')
88+
'Git4Idea',
89+
'org.jetbrains.plugins.github'
8190
]
8291
}
8392
patchPluginXml {
93+
// see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description
94+
sinceBuild = build_version
95+
8496
changeNotes = """<pre style="font-family: sans-serif">
8597
Major update release 3.*!
8698

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package net.seesharpsoft.intellij.plugins.csv;
22

3+
import com.intellij.ide.BrowserUtil;
34
import com.intellij.ide.actions.ShowSettingsUtilImpl;
45
import com.intellij.ide.plugins.IdeaPluginDescriptor;
56
import com.intellij.ide.plugins.PluginManagerCore;
6-
import com.intellij.ide.ui.IdeUiService;
77
import com.intellij.notification.*;
88
import com.intellij.openapi.extensions.PluginId;
99
import com.intellij.openapi.options.ShowSettingsUtil;
@@ -37,7 +37,7 @@ private static void openLink(Project project, String link) {
3737
if (link.startsWith("#")) {
3838
((ShowSettingsUtilImpl) ShowSettingsUtil.getInstance()).showSettingsDialog(project, link.substring(1), null);
3939
} else {
40-
IdeUiService.getInstance().browse(link);
40+
BrowserUtil.browse(link);
4141
}
4242
}
4343

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.intellij.openapi.editor.colors.EditorFontType;
99
import com.intellij.openapi.fileEditor.*;
1010
import com.intellij.openapi.project.Project;
11-
import com.intellij.openapi.util.CheckedDisposable;
1211
import com.intellij.openapi.util.Key;
1312
import com.intellij.openapi.util.UserDataHolder;
1413
import com.intellij.openapi.util.UserDataHolderBase;
@@ -32,7 +31,7 @@
3231
import java.util.Arrays;
3332
import java.util.Collection;
3433

35-
public abstract class CsvTableEditor implements FileEditor, FileEditorLocation, CheckedDisposable, PsiFileHolder {
34+
public abstract class CsvTableEditor implements FileEditor, FileEditorLocation, PsiFileHolder {
3635

3736
public static final String EDITOR_NAME = "Table Editor";
3837

@@ -190,7 +189,6 @@ public void dispose() {
190189
getTableModel().dispose();
191190
}
192191

193-
@Override
194192
public boolean isDisposed() {
195193
return this.myDisposed;
196194
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorActionListeners.java

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;
22

3+
import com.intellij.ide.BrowserUtil;
34
import com.intellij.openapi.fileEditor.FileEditorManager;
45
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
56
import com.intellij.ui.components.labels.LinkLabel;
67
import com.intellij.ui.components.labels.LinkListener;
78
import net.seesharpsoft.intellij.plugins.csv.editor.table.CsvTableActions;
89

910
import javax.swing.*;
10-
import java.awt.*;
1111
import java.awt.event.ActionListener;
12-
import java.io.IOException;
13-
import java.net.URI;
1412
import java.util.Arrays;
1513
import java.util.stream.Collectors;
1614

@@ -173,16 +171,7 @@ public void linkSelected(LinkLabel linkLabel, Object o) {
173171
private final class OpenCsvPluginLink implements LinkListener {
174172
@Override
175173
public void linkSelected(LinkLabel linkLabel, Object o) {
176-
if (Desktop.isDesktopSupported()) {
177-
Desktop desktop = Desktop.getDesktop();
178-
if (desktop.isSupported(Desktop.Action.BROWSE)) {
179-
try {
180-
desktop.browse(URI.create("https://github.com/SeeSharpSoft/intellij-csv-validator"));
181-
} catch (IOException e) {
182-
e.printStackTrace();
183-
}
184-
}
185-
}
174+
BrowserUtil.browse("https://github.com/SeeSharpSoft/intellij-csv-validator");
186175
}
187176
}
188177
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/formatter/CsvFormattingModelBuilder.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
3939
return builder;
4040
}
4141

42+
private static ExternalFormattingModelBuilderImpl DUMMY_FORMATTING_MODEL_PROVIDER = new ExternalFormattingModelBuilderImpl(null);
43+
4244
@Override
4345
@NotNull
4446
public FormattingModel createModel(FormattingContext formattingContext) {
4547
switch (formattingContext.getFormattingMode()) {
4648
case ADJUST_INDENT:
4749
case ADJUST_INDENT_ON_ENTER:
4850
// do not care about indent during editing (baaad performance)
49-
return FormatterImpl.getInstance().createDummyFormattingModel(formattingContext.getPsiElement());
51+
// NOTE: Formatter.getInstance().createDummyFormattingModel(formattingContext.getPsiElement()); <-- marked as internal, but this DummyFormattingModel is all I want
52+
return DUMMY_FORMATTING_MODEL_PROVIDER.createModel(formattingContext);
5053
case REFORMAT:
5154
PsiElement element = formattingContext.getPsiElement();
5255
CodeStyleSettings settings = formattingContext.getCodeStyleSettings();

src/main/resources/META-INF/plugin.xml

-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@
4545
</p>
4646
]]></description>
4747

48-
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
49-
<idea-version since-build="221" />
50-
5148
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html on how to target different products -->
5249
<depends>com.intellij.modules.lang</depends>
5350
<depends optional="true" config-file="withGithub.xml">org.jetbrains.plugins.github</depends>

0 commit comments

Comments
 (0)