Skip to content

Commit 255c16b

Browse files
authored
Merge pull request #61 from xzescha/fixes_and_improvements
Fixed build.gradle, gradle.properties and pom.xml
2 parents 5a07317 + ed86ab8 commit 255c16b

File tree

18 files changed

+144
-134
lines changed

18 files changed

+144
-134
lines changed

.github/workflows/codecov.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ jobs:
1414
gradle jacocoTestReport
1515
- uses: codecov/codecov-action@v2
1616
with:
17+
token: ${{ secrets.CODECOV_TOKEN }}
1718
file: build/reports/jacoco/report.xml
18-
fail_ci_if_error: true
19+
fail_ci_if_error: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ Its `pom` file should contain `eo-maven-plugin` configuration as follows:
8080
</plugins>
8181
</build>
8282
```
83-
Having this set up compilation can be triggered by `Build -> EO compile` menu action.
83+
Having this set up compilation can be triggered by `Build -> EO compile` menu action.

build.gradle

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ buildscript {
22
repositories {
33
mavenCentral()
44
repositories {
5-
maven { url "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven" }
5+
maven { url "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven/" }
6+
67
}
78
}
89
dependencies {
@@ -11,7 +12,7 @@ buildscript {
1112

1213

1314
plugins {
14-
id "org.jetbrains.intellij" version "1.14.2"
15+
id "org.jetbrains.intellij" version "1.17.4"
1516
}
1617

1718
java {
@@ -23,34 +24,48 @@ java {
2324
group 'antlr'
2425
version pluginVersion
2526

27+
2628
apply plugin: 'java'
2729
apply plugin: 'org.jetbrains.intellij'
2830
apply plugin: 'antlr'
2931
apply plugin: 'jacoco'
3032

33+
task cleanParser(type: Delete) {
34+
delete fileTree("src/main/java/org/eolang/jetbrains/parser") //Deletes antlr auto-generated classes
35+
}
36+
37+
task qulice(type: Exec) {
38+
workingDir "${projectDir}"
39+
def mvnExecutable = System.properties['os.name'].toLowerCase().contains('windows') ? 'mvn.cmd' : 'mvn'
40+
commandLine mvnExecutable, 'com.qulice:qulice-maven-plugin:check', '-e', '-X'
41+
42+
standardOutput = new FileOutputStream("qulice.log")
43+
errorOutput = new FileOutputStream("qulice-error.log")
44+
}
45+
3146
task getGrammar {
3247
doFirst {
33-
def f = new File('src/main/antlr/org/jetbrains/eolang/parser/EO.g4')
48+
def f = new File('src/main/antlr/org/jetbrains/eolang/parser/Eo.g4')
3449
if (!f.exists())
35-
println("Created destination file: src/main/antlr/org/jetbrains/eolang/parser/EO.g4")
50+
println("Created destination file: src/main/antlr/org/jetbrains/eolang/parser/Eo.g4")
3651
else {
3752
println("File already exists. Delete it and rerun task")
3853
return
3954
}
4055
println("Creating and downloading grammar file from " +
4156
"https://raw.githubusercontent.com/objectionary/" +
42-
"eo/master/eo-parser/src/main/antlr4/org/eolang/parser/Program.g4")
57+
"eo/refs/heads/master/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4")
4358

44-
new URL('https://raw.githubusercontent.com/objectionary/eo/master/eo-parser/src/main/antlr4/org/eolang/parser/Program.g4').
59+
new URL('https://raw.githubusercontent.com/objectionary/eo/refs/heads/master/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4').
4560
withInputStream { i -> f.withOutputStream { it << i } }
4661
f.append('\n\nBAD_CHARACTER\n' +
4762
'\t:\t.\t-> channel(HIDDEN)\n' +
4863
'\t;')
4964
if (f.exists())
5065
println("Grammar downloading is completed")
5166

52-
ant.replaceregexp(match: 'Program', replace: 'EO', flags: 'g', byline: true) {
53-
fileset(dir: 'src/main/antlr/org/jetbrains/eolang/parser', includes: 'EO.g4')
67+
ant.replaceregexp(match: 'Program', replace: 'Eo', flags: 'g', byline: true) {
68+
fileset(dir: 'src/main/antlr/org/jetbrains/eolang/parser', includes: 'Eo.g4')
5469
}
5570
}
5671
}
@@ -69,10 +84,8 @@ jacocoTestReport {
6984
}
7085
}
7186

72-
task qulice (type: Exec) {
73-
workingDir "${projectDir}"
74-
commandLine 'mvn', 'com.qulice:qulice-maven-plugin:check'
75-
}
87+
88+
7689

7790
compileJava {
7891
sourceCompatibility = '1.8'
@@ -92,6 +105,9 @@ intellij {
92105
plugins = ["com.intellij.java", "org.jetbrains.idea.maven"]
93106
}
94107

108+
test {
109+
useJUnitPlatform() // Sign to use JUnit 5
110+
}
95111

96112
publishPlugin {
97113
dependsOn(test)
@@ -100,6 +116,8 @@ publishPlugin {
100116

101117
generateGrammarSource {
102118
dependsOn(getGrammar)
119+
dependsOn(qulice)
120+
dependsOn(cleanParser)
103121
outputDirectory = new File("src/main/java/org/eolang/jetbrains/parser".toString())
104122
arguments += ["-package", "org.eolang.jetbrains.parser", "-Xexact-output-dir"]
105123
}
@@ -116,11 +134,18 @@ dependencies {
116134
}
117135
implementation 'org.antlr:antlr4-intellij-adaptor:0.1'
118136
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
137+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
138+
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
139+
implementation 'org.jetbrains:annotations:13.0'
119140
}
120141

142+
143+
121144
build {
122-
dependsOn(qulice)
145+
dependsOn(jacocoTestReport)
123146
}
124147

148+
149+
125150
sourceCompatibility = JavaVersion.VERSION_1_9
126151
targetCompatibility = JavaVersion.VERSION_1_9

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ideaVersion = 2021.1
1+
ideaVersion = 2023.3
22

33
antlr4Version = 4.13.1
44

pom.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<name>eo-intellij-plugin</name>
88
<description>Plugin for EO lang</description>
99
<url>https://github.com/objectionary/eo-intellij-plugin</url>
10-
<inceptionYear>2022</inceptionYear>
10+
<inceptionYear>2025</inceptionYear>
1111
<organization>
1212
<name>EO</name>
1313
<url>https://github.com/objectionary/eo-intellij-plugin</url>
@@ -35,13 +35,17 @@
3535
<plugin>
3636
<groupId>com.qulice</groupId>
3737
<artifactId>qulice-maven-plugin</artifactId>
38+
<version>0.24.0</version>
3839
<configuration>
39-
<license>file:LICENSE.txt</license>
40-
<excludes combine.children="append">
41-
<exclude>pmd:/src/main/java/org/eolang/jetbrains/parser/.*</exclude>
42-
<exclude>checkstyle:/src/main/java/org/eolang/jetbrains/parser/.*</exclude>
43-
</excludes>
40+
<license>file:${basedir}/LICENSE.txt</license>
4441
</configuration>
42+
<executions>
43+
<execution>
44+
<goals>
45+
<goal>check</goal>
46+
</goals>
47+
</execution>
48+
</executions>
4549
</plugin>
4650
</plugins>
4751
</build>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
In this folder should be located EO.h4 grammar file.
1+
In this folder should be located EO.g4 grammar file.
22
You may run getGrammar task for doing that or you may run build task

src/main/java/org/eolang/jetbrains/EoColorSettingsPage.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,15 @@ public class EoColorSettingsPage implements ColorSettingsPage {
4343
/**
4444
* Here we describe tokens for display them in settings page.
4545
*/
46-
private static final AttributesDescriptor[] DESCRIPTORS =
47-
new AttributesDescriptor[] {
48-
new AttributesDescriptor("Keywords", EoSyntaxHighlighter.KEYWORD),
49-
new AttributesDescriptor("Comments", EoSyntaxHighlighter.COMMENT),
50-
new AttributesDescriptor("Identifiers", EoSyntaxHighlighter.NAME),
51-
new AttributesDescriptor("Strings", EoSyntaxHighlighter.STRING),
52-
new AttributesDescriptor("Metas", EoSyntaxHighlighter.META),
53-
new AttributesDescriptor("Constants", EoSyntaxHighlighter.NUMBERS),
54-
new AttributesDescriptor("Braces", EoSyntaxHighlighter.BRACES),
55-
};
46+
private static final AttributesDescriptor[] DESCRIPTORS = {
47+
new AttributesDescriptor("Keywords", EoSyntaxHighlighter.KEYWORD),
48+
new AttributesDescriptor("Comments", EoSyntaxHighlighter.COMMENT),
49+
new AttributesDescriptor("Identifiers", EoSyntaxHighlighter.NAME),
50+
new AttributesDescriptor("Strings", EoSyntaxHighlighter.STRING),
51+
new AttributesDescriptor("Metas", EoSyntaxHighlighter.META),
52+
new AttributesDescriptor("Constants", EoSyntaxHighlighter.NUMBERS),
53+
new AttributesDescriptor("Braces", EoSyntaxHighlighter.BRACES),
54+
};
5655

5756
@Nullable
5857
@Override

src/main/java/org/eolang/jetbrains/EoCompileAction.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
*/
2424
package org.eolang.jetbrains;
2525

26-
import com.intellij.notification.Notification;
26+
import com.intellij.notification.NotificationGroupManager;
2727
import com.intellij.notification.NotificationType;
28-
import com.intellij.notification.Notifications;
2928
import com.intellij.openapi.actionSystem.AnAction;
3029
import com.intellij.openapi.actionSystem.AnActionEvent;
3130
import com.intellij.openapi.actionSystem.DataContext;
@@ -105,13 +104,9 @@ private static void performUnsafe(final AnActionEvent action) {
105104
* @param reason Reason
106105
*/
107106
private static void notifyCannotCompile(final String reason) {
108-
Notifications.Bus.notify(
109-
new Notification(
110-
Notifications.SYSTEM_MESSAGES_GROUP_ID,
111-
"Cannot compile EO",
112-
reason,
113-
NotificationType.WARNING
114-
)
115-
);
107+
NotificationGroupManager.getInstance()
108+
.getNotificationGroup("System Messages")
109+
.createNotification("Cannot compile EO", reason, NotificationType.WARNING)
110+
.notifyAll();
116111
}
117112
}

src/main/java/org/eolang/jetbrains/EoExternalAnnotator.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,24 @@
3131
import com.intellij.psi.PsiFile;
3232
import java.util.ArrayList;
3333
import java.util.List;
34+
import org.jetbrains.annotations.Contract;
3435
import org.jetbrains.annotations.NotNull;
35-
import org.jetbrains.annotations.Nullable;
36+
37+
//@checkstyle JavadocTagsCheck (9 lines)
3638

3739
/**
3840
* An external annotator is an object that analyzes code in a document and annotates the PSI
3941
* elements with errors or warnings. Because such analysis can be expensive, we don't want it in the
4042
* GUI event loop. Jetbrains provides this external annotator mechanism to run these analyzers out
4143
* of band.
42-
* @since 0.0.0
43-
* @checkstyle MultilineJavadocTagsCheck (200 lines)
44-
* @checkstyle MemberNameCheck (200 lines)
4544
*/
45+
@SuppressWarnings("PMD.SystemPrintln")
4646
public class EoExternalAnnotator
4747
extends ExternalAnnotator<PsiFile, List<EoExternalAnnotator.Issue>> {
4848

4949
// Called first; in our case, just return file and do nothing.
5050
@Override
51-
@Nullable
52-
public final PsiFile collectInformation(@NotNull final PsiFile file) {
51+
public final @NotNull PsiFile collectInformation(@NotNull final PsiFile file) {
5352
return file;
5453
}
5554

@@ -61,17 +60,23 @@ public final PsiFile collectInformation(@NotNull final PsiFile file) {
6160
* compiler or interpreter to get error messages or other bits of information you'd
6261
* like to annotate the document with.
6362
*/
63+
@Contract(value = "_ -> new", pure = true)
6464
@Override
65-
public final List<Issue> doAnnotate(final PsiFile file) {
65+
public final @NotNull List<Issue> doAnnotate(final PsiFile file) {
6666
return new ArrayList<>(0);
6767
}
6868

6969
// Called 3rd to actually annotate the editor window.
70+
7071
@Override
71-
public final void apply(@NotNull final PsiFile file, final List<Issue> issues,
72+
public final void apply(@NotNull final PsiFile file, final @NotNull List<Issue> issues,
7273
@NotNull final AnnotationHolder holder) {
7374
for (final Issue issue : issues) {
74-
final TextRange range = issue.getOffendingNode().getTextRange();
75+
final TextRange range = issue.getOffendnode().getTextRange();
76+
if (range.getStartOffset() > range.getEndOffset()) {
77+
System.err.println("Invalid TextRange");
78+
continue;
79+
}
7580
holder.createErrorAnnotation(range, issue.getMsg());
7681
}
7782
}
@@ -90,7 +95,7 @@ public static class Issue {
9095
/**
9196
* Node.
9297
*/
93-
private final PsiElement offendingNode;
98+
private final PsiElement offendnode;
9499

95100
/**
96101
* Issue init.
@@ -99,7 +104,7 @@ public static class Issue {
99104
*/
100105
public Issue(final String msg, final PsiElement node) {
101106
this.msg = msg;
102-
this.offendingNode = node;
107+
this.offendnode = node;
103108
}
104109

105110
/**
@@ -114,8 +119,8 @@ final String getMsg() {
114119
* Accessor.
115120
* @return Offending node
116121
*/
117-
final PsiElement getOffendingNode() {
118-
return this.offendingNode;
122+
final PsiElement getOffendnode() {
123+
return this.offendnode;
119124
}
120125
}
121126
}

src/main/java/org/eolang/jetbrains/EoFileTypeFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24-
2524
package org.eolang.jetbrains;
2625

2726
import com.intellij.openapi.fileTypes.FileTypeConsumer;

0 commit comments

Comments
 (0)