diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f577a152c921d81814a44d3f9964c5fdd7ffca3..f4381191d33767d6c5ddaa3602034634da1e1d5a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,16 +5,16 @@ stages: - deploy test: - image: openjdk:11 + image: openjdk:17 stage: test script: - ./gradlew --continue --console=plain --info runPluginVerifier jar: - image: openjdk:11 + image: openjdk:17 stage: jar script: - ./gradlew --continue --console=plain --info buildPlugin artifacts: paths: - - "/builds/jastadd/*/build/libs/JastAddIntelliJPlugin-*.jar" + - "build/libs/JastAddIntelliJPlugin-*.jar" diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ac58555991f2be7fbc0efecf8d985b7a26d581..214d3bd7e92c94174b291ed7f0f6929ae6e62f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,8 @@ # Changelog -## [0.3.1] +## [Unreleased] ### Added -- Reference support for type names within aspect files. - - Usages are now highlighted. -- Refactoring of type names now also works in aspects. - - Note that although it works in the Java embeddings within aspects, it does *not* work in "real" Java classes. - - Please use this feature with caution. As with most refactoring tools, it is quite fragile and won't give correct - results in all cases. -- Folding support for aspect files. - - Aspects and most blocks now can be folded. -- Structure view for aspect files. - - Attributes and inter-type declarations are shown sorted by aspect. - - There are toggle buttons to show or hide attributes, inter-type declarations and rewrites. - - Note that things outside aspects, equations and some other elements are not yet included. -- Support for IntelliJ IDEA 2022.3. ### Changed @@ -23,21 +10,42 @@ ### Removed +### Fixed + +## [0.3.1] + +### Added +- Usages are now highlighted. +- Note that although it works in the Java embeddings within aspects, it does *not* work in "real" Java classes. + Please use this feature with caution. As with most refactoring tools, it is quite fragile and won't give correct + results in all cases. +- Aspects and most blocks now can be folded. +- Attributes and inter-type declarations are shown sorted by aspect. +- There are toggle buttons to show or hide attributes, inter-type declarations and rewrites. +- Note that things outside aspects, equations and some other elements are not yet included. +- Support for IntelliJ IDEA 2022.3 and 2023.1. + ### Fixed - A bug for type name refactoring in grammar files which prevented the actual definition from being renamed. - Wrong inspection messages related to names in wrappers of injected java code ("x", "m", "X"). +- A bug that required a visibility modifier in refined constructors. + +### Removed +- Support for all IntelliJ IDEA version prior to 2022.3. ## [0.2.0] ### Added - Support for IntelliJ IDEA 2021.2.3. -- Initial support for JastAdd aspect files. - - syntax highlighter and color settings - - two file types for jrag and jadd - - embedded java for attribute equation blocks -- Annotations for JastAdd usages in Java. - - configurable highlighters for attribute and api usages +- syntax highlighter and color settings + two file types for jrag and jadd + embedded java for attribute equation blocks +- configurable highlighters for attribute and api usages - Dark mode icon which is a bit less colourful. ### Removed - Support for IntelliJ IDEA 2020.2.4. Minimal version now is 2021.1.1. + +[Unreleased]: https://git-st.inf.tu-dresden.de/jastadd/jetbrains-plugin//compare/v0.3.1...HEAD +[0.3.1]: https://git-st.inf.tu-dresden.de/jastadd/jetbrains-plugin//compare/v0.2.0...v0.3.1 +[0.2.0]: https://git-st.inf.tu-dresden.de/jastadd/jetbrains-plugin//commits/v0.2.0 diff --git a/README.md b/README.md index 6c61ab484cc8d055c760ff5766f6c84673c69089..5b873fd76196d1fdaddd3c33177476f3b8e33a4b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # JastAdd Language Support <!-- Plugin description --> -This plugin provides support for [JastAdd](https://jastadd.cs.lth.se/) and [Relational RAGs](http://relational-rags.eu) +This plugin provides support for [JastAdd](https://jastadd.cs.lth.se/) and [Relational RAGs](https://jastadd.pages.st.inf.tu-dresden.de/relational-rags/) <!-- Plugin description end --> diff --git a/build.gradle.kts b/build.gradle.kts index 0271d5cba28cbad34d62dd1c57edabc64548dcfb..732777ab5cf15303e7c6ea14a2385b97544c773f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,8 @@ import io.gitlab.arturbosch.detekt.Detekt +import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.grammarkit.tasks.GenerateLexer -import org.jetbrains.grammarkit.tasks.GenerateParser +import org.jetbrains.grammarkit.tasks.GenerateLexerTask +import org.jetbrains.grammarkit.tasks.GenerateParserTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile fun properties(key: String) = project.findProperty(key).toString() @@ -12,17 +13,17 @@ plugins { // Java support id("java") // Kotlin support - id("org.jetbrains.kotlin.jvm") version "1.5.10" + id("org.jetbrains.kotlin.jvm") version "1.8.20" // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin - id("org.jetbrains.intellij") version "1.0" + id("org.jetbrains.intellij") version "1.13.3" // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin - id("org.jetbrains.changelog") version "1.1.2" + id("org.jetbrains.changelog") version "2.0.0" // detekt linter - read more: https://detekt.github.io/detekt/gradle.html - id("io.gitlab.arturbosch.detekt") version "1.18.1" + id("io.gitlab.arturbosch.detekt") version "1.23.0" // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle - id("org.jlleitschuh.gradle.ktlint") version "10.2.0" - - id("org.jetbrains.grammarkit") version "2021.1.3" + id("org.jlleitschuh.gradle.ktlint") version "11.3.2" + // grammrkit - read more: https://plugins.gradle.org/plugin/org.jetbrains.grammarkit + id("org.jetbrains.grammarkit") version "2022.3.1" } group = properties("pluginGroup") @@ -32,9 +33,7 @@ version = properties("pluginVersion") repositories { mavenCentral() } -dependencies { - detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.18.1") -} + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -68,55 +67,49 @@ sourceSets { // Configure gradle-changelog-plugin plugin. // Read more: https://github.com/JetBrains/gradle-changelog-plugin changelog { - version = properties("pluginVersion") - groups = listOf("Added", "Changed", "Deprecated", "Removed", "Fixed") + version.set(properties("pluginVersion")) + groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed")) + repositoryUrl.set(properties("pluginRepositoryUrl")) } // Configure detekt plugin. // Read more: https://detekt.github.io/detekt/kotlindsl.html detekt { - config = files("./detekt-config.yml") - buildUponDefaultConfig = true - - reports { - html.enabled = true - xml.enabled = false - txt.enabled = false - } + source.from(files("build.gradle.kts")) } tasks { - val generateGrammarLexer = task<GenerateLexer>("generateGrammarLexer") { - source = "src/main/grammar/Grammar.flex" - targetDir = "src/gen/java/org/jastadd/tooling/grammar/lexer/" - targetClass = "GrammarLexer" - purgeOldFiles = true + val generateGrammarLexer = task<GenerateLexerTask>("generateGrammarLexer") { + sourceFile.set(file("src/main/grammar/Grammar.flex")) + targetDir.set("src/gen/java/org/jastadd/tooling/grammar/lexer/") + targetClass.set("GrammarLexer") + purgeOldFiles.set(true) } // not fully working because of https://github.com/JetBrains/gradle-grammar-kit-plugin/issues/3 - val generateGrammarParser = task<GenerateParser>("generateGrammarParser") { - source = "src/main/grammar/Grammar.bnf" - targetRoot = "src/gen/java" - pathToParser = "/org/jastadd/tooling/grammar/GrammarParser.java" - pathToPsiRoot = "/org/jastadd/tooling/grammar/psi" - purgeOldFiles = true + val generateGrammarParser = task<GenerateParserTask>("generateGrammarParser") { + sourceFile.set(file("src/main/grammar/Grammar.bnf")) + targetRoot.set("src/gen/java") + pathToParser.set("/org/jastadd/tooling/grammar/GrammarParser.java") + pathToPsiRoot.set("/org/jastadd/tooling/grammar/psi") + purgeOldFiles.set(true) } - val generateAspectLexer = task<GenerateLexer>("generateAspectLexer") { - source = "src/main/grammar/Aspect.flex" - targetDir = "src/gen/java/org/jastadd/tooling/aspect/lexer/" - targetClass = "AspectLexer" - purgeOldFiles = true + val generateAspectLexer = task<GenerateLexerTask>("generateAspectLexer") { + sourceFile.set(file("src/main/grammar/Aspect.flex")) + targetDir.set("src/gen/java/org/jastadd/tooling/aspect/lexer/") + targetClass.set("AspectLexer") + purgeOldFiles.set(true) } // not fully working because of https://github.com/JetBrains/gradle-grammar-kit-plugin/issues/3 - val generateAspectParser = task<GenerateParser>("generateAspectParser") { - source = "src/main/grammar/Aspect.bnf" - targetRoot = "src/gen/java" - pathToParser = "/org/jastadd/tooling/aspect/AspectParser.java" - pathToPsiRoot = "/org/jastadd/tooling/aspect/psi" - purgeOldFiles = true + val generateAspectParser = task<GenerateParserTask>("generateAspectParser") { + sourceFile.set(file("src/main/grammar/Aspect.bnf")) + targetRoot.set("src/gen/java") + pathToParser.set("/org/jastadd/tooling/aspect/AspectParser.java") + pathToPsiRoot.set("/org/jastadd/tooling/aspect/psi") + purgeOldFiles.set(true) } compileJava { @@ -128,15 +121,15 @@ tasks { // Set the compatibility versions to 1.8 withType<JavaCompile> { - sourceCompatibility = "1.8" - targetCompatibility = "1.8" + sourceCompatibility = "17" + targetCompatibility = "17" } withType<KotlinCompile> { - kotlinOptions.jvmTarget = "1.8" + kotlinOptions.jvmTarget = "17" } withType<Detekt> { - jvmTarget = "1.8" + jvmTarget = "17" } patchPluginXml { @@ -158,11 +151,11 @@ tasks { ) // Get the latest available change notes from the changelog file - changeNotes.set(provider { changelog.getLatest().toHTML() }) + changeNotes.set(provider { changelog.renderItem(changelog.get(properties("pluginVersion")), Changelog.OutputType.HTML) }) } - runPluginVerifier { - ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)) + jar { + dependsOn("patchChangelog") } publishPlugin { diff --git a/detekt-config.yml b/detekt-config.yml deleted file mode 100644 index 874b29a3babcdeedc0e1a1762d8e8c71734ec90f..0000000000000000000000000000000000000000 --- a/detekt-config.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Default detekt configuration: -# https://github.com/detekt/detekt/blob/master/detekt-core/src/main/resources/default-detekt-config.yml - -formatting: - Indentation: - continuationIndentSize: 8 - ParameterListWrapping: - indentSize: 8 diff --git a/gradle.properties b/gradle.properties index 16b68b231aa7308e231f803fb1a92b9ad033e7f9..90c64ca344a5cda6b6efd6211fb5b4ac13f1af0b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,18 +4,19 @@ pluginGroup = org.jastadd pluginName = JastAdd pluginVersion = 0.3.1 +pluginRepositoryUrl = https://git-st.inf.tu-dresden.de/jastadd/jetbrains-plugin/ # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild = 211 -pluginUntilBuild = 223.* +pluginSinceBuild = 223 +pluginUntilBuild = 231.* -# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl -# See https://jb.gg/intellij-platform-builds-list for available build versions. -pluginVerifierIdeVersions = 2021.1.3, 2021.2.4, 2021.3.3, 2022.1.4, 2022.2.4, 2022.3.1 +## Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl +## See https://jb.gg/intellij-platform-builds-list for available build versions. +#pluginVerifierIdeVersions = 2022.2.4, 2022.3.1, 2023.1.2 platformType = IC -platformVersion = 2021.3.1 +platformVersion = 2022.3.1 platformDownloadSources = true # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3ab0b725efcd0688fc0bb2b08f7002308d2e1961..070cb702f09eda497286745407381bcc5dfe94fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/grammar/Aspect.bnf b/src/main/grammar/Aspect.bnf index 2f032fec7d8b043f663ad814d794786c3acef3f2..51dd068e8594235734474923a1e565650a0ee7cd 100644 --- a/src/main/grammar/Aspect.bnf +++ b/src/main/grammar/Aspect.bnf @@ -111,7 +111,7 @@ aspect_refine_method_declaration ::= REFINE [aspect_name] modifiers type_paramet aspect_constructor_declaration ::= modifiers ast_type_name DOT ast_type_name formal_parameters (THROWS name_list)? LBRACE explicit_constructor_invocation? block_statement* RBRACE -aspect_refine_constructor_declaration ::= REFINE aspect_name (PUBLIC | PROTECTED | PRIVATE) ast_type_name DOT method_name formal_parameters (THROWS name_list)? LBRACE block_statement* RBRACE +aspect_refine_constructor_declaration ::= REFINE aspect_name (PUBLIC | PROTECTED | PRIVATE)? ast_type_name DOT method_name formal_parameters (THROWS name_list)? LBRACE block_statement* RBRACE aspect_field_declaration ::= modifiers aspect_type ast_type_name DOT variable_declarator (COMMA variable_declarator)* SEMICOLON diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index d84dd364f37c819a7929e7af627878c00d78fbf6..f0295375b2c78ae0fd10b152f7751aedd8659240 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,8 +1,7 @@ <idea-plugin> <id>org.jastadd.JastAddGrammar</id> <name>JastAdd Grammar Language</name> - <vendor email="johannes.mey@tu-dresden.de" url="jastadd.org">The JastAdd Team</vendor> - + <vendor email="johannes.mey@tu-dresden.de" url="jastadd.org">Johannes Mey</vendor> <!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html on how to target different products --> @@ -32,7 +31,7 @@ <completion.contributor language="JastAddGrammar" implementationClass="org.jastadd.tooling.grammar.GrammarCompletionContributor"/> - <psi.referenceContributor implementation="org.jastadd.tooling.grammar.GrammarReferenceContributor"/> + <psi.referenceContributor language="JastAddGrammar" implementation="org.jastadd.tooling.grammar.GrammarReferenceContributor"/> <lang.refactoringSupport language="JastAddGrammar" @@ -80,7 +79,7 @@ <colorSettingsPage implementation="org.jastadd.tooling.java.JavaColorSettingsPage"/> - <psi.referenceContributor implementation="org.jastadd.tooling.aspect.AspectReferenceContributor"/> + <psi.referenceContributor language="JastAddAspect" implementation="org.jastadd.tooling.aspect.AspectReferenceContributor"/> <lang.elementManipulator forClass="org.jastadd.tooling.aspect.psi.JastAddAspectAstTypeName" implementationClass="org.jastadd.tooling.aspect.psi.JastAddAspectAstTypeNameManipulator"/>