From aa5498ce929c67189c680f6fe490585f54dc986a Mon Sep 17 00:00:00 2001 From: valery-labuzhsky Date: Mon, 23 Sep 2024 11:04:09 +0100 Subject: [PATCH 1/4] [IDEA] Version 1.4.0.1 --- IDEA/build.gradle.kts | 42 +++++++++++++------ IDEA/gradle/wrapper/gradle-wrapper.properties | 2 +- .../ideaplugin/format/KerboScriptBlock.java | 4 +- IDEA/src/main/resources/META-INF/plugin.xml | 3 +- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/IDEA/build.gradle.kts b/IDEA/build.gradle.kts index f454c90..ec49037 100644 --- a/IDEA/build.gradle.kts +++ b/IDEA/build.gradle.kts @@ -1,15 +1,19 @@ import org.jetbrains.grammarkit.tasks.GenerateLexerTask import org.jetbrains.grammarkit.tasks.GenerateParserTask +import org.jetbrains.intellij.platform.gradle.TestFrameworkType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id("org.jetbrains.intellij") version "1.14.1" - id("org.jetbrains.kotlin.jvm") version "1.8.22" - id("org.jetbrains.grammarkit") version "2022.3.1" + id("org.jetbrains.intellij.platform") version "2.0.1" + id("org.jetbrains.kotlin.jvm") version "2.0.20" + id("org.jetbrains.grammarkit") version "2022.3.2.2" } repositories { mavenCentral() + intellijPlatform { + defaultRepositories() + } } // Java target version @@ -31,6 +35,15 @@ kotlin { } dependencies { + intellijPlatform { + intellijIdeaCommunity("2024.2.1") + + bundledPlugins(listOf("com.intellij.java")) + instrumentationTools() + + testFramework(TestFrameworkType.Platform) + } + // From Kotlin documentation implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.22") // just in case, version number specified in buildscript is used by default @@ -47,24 +60,30 @@ dependencies { // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html -intellij { - version.set("2023.1.2") - type.set("IC") // Target IDE Platform +intellijPlatform { + pluginConfiguration { + // ... + + version = "1.4.0.1" - plugins.set(listOf("com.intellij.java")) + ideaVersion { + sinceBuild = "242.21829.142" + untilBuild = provider { null } + } + } } project(":") { val generateLexer = task("generateMyLexer") { sourceFile.set(file("src/main/grammar/KerboScript.flex")) - targetDir.set("src/gen/ksp/kos/ideaplugin/parser") - targetClass.set("KerboScriptLexer") + targetOutputDir.set(file("src/gen/ksp/kos/ideaplugin/parser")) +// targetClass.set("KerboScriptLexer") purgeOldFiles.set(true) } val generateParser = task("generateMyParser") { sourceFile.set(file("src/main/grammar/KerboScript.bnf")) - targetRoot.set("src/gen") + targetRootOutputDir.set(file("src/gen")) pathToParser.set("/ksp/kos/ideaplugin/parser/KerboScriptParser.java") pathToPsiRoot.set("/ksp/kos/ideaplugin/psi") purgeOldFiles.set(true) @@ -85,7 +104,7 @@ project(":") { getByName(it) { kotlinOptions { jvmTarget = "17" - freeCompilerArgs = listOf("-Xjvm-default=enable") + freeCompilerArgs = listOf("-Xjvm-default=all") } } } @@ -106,7 +125,6 @@ tasks.test { allprojects { gradle.projectsEvaluated { tasks.withType { - options.compilerArgs.add("-Werror") options.compilerArgs.add("-Xlint:all") options.compilerArgs.add("-Xlint:-serial") } diff --git a/IDEA/gradle/wrapper/gradle-wrapper.properties b/IDEA/gradle/wrapper/gradle-wrapper.properties index 1f017e4..28f5fcf 100644 --- a/IDEA/gradle/wrapper/gradle-wrapper.properties +++ b/IDEA/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/IDEA/src/main/java/ksp/kos/ideaplugin/format/KerboScriptBlock.java b/IDEA/src/main/java/ksp/kos/ideaplugin/format/KerboScriptBlock.java index e3a5192..30595b2 100644 --- a/IDEA/src/main/java/ksp/kos/ideaplugin/format/KerboScriptBlock.java +++ b/IDEA/src/main/java/ksp/kos/ideaplugin/format/KerboScriptBlock.java @@ -9,7 +9,6 @@ import com.intellij.psi.tree.IElementType; import ksp.kos.ideaplugin.KerboScriptFile; import ksp.kos.ideaplugin.psi.KerboScriptIfStmt; -import ksp.kos.ideaplugin.psi.KerboScriptInstruction; import ksp.kos.ideaplugin.psi.KerboScriptInstructionBlock; import ksp.kos.ideaplugin.psi.KerboScriptTypes; import org.jetbrains.annotations.NotNull; @@ -18,6 +17,7 @@ import java.util.*; import static ksp.kos.ideaplugin.psi.KerboScriptTypes.CURLYCLOSE; +import static ksp.kos.ideaplugin.psi.KerboScriptTypes.CURLYOPEN; /** * Created on 17/01/16. @@ -55,7 +55,7 @@ public Indent getIndent() { if (psi.getParent() == null || psi.getParent() instanceof KerboScriptFile) { return Indent.getNoneIndent(); } else if (psi.getParent() instanceof KerboScriptInstructionBlock) { - if (psi.getNode().getElementType() == CURLYCLOSE) { + if (psi.getNode().getElementType() == CURLYCLOSE || psi.getNode().getElementType() == CURLYOPEN) { return Indent.getNoneIndent(); } return Indent.getNormalIndent(); diff --git a/IDEA/src/main/resources/META-INF/plugin.xml b/IDEA/src/main/resources/META-INF/plugin.xml index 5229abc..79c0d45 100644 --- a/IDEA/src/main/resources/META-INF/plugin.xml +++ b/IDEA/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,6 @@ kos-ksp.idea-plugin KerboScript(kOS) - 1.4 Valery Labuzhsky @@ -77,7 +76,7 @@ kOS version supported: 1.4 - + From e19bba8734e1cbbf34009b42d902acfbc1dd10ce Mon Sep 17 00:00:00 2001 From: valery-labuzhsky Date: Mon, 23 Sep 2024 11:44:31 +0100 Subject: [PATCH 2/4] [IDEA] fix github upload artifact --- .github/workflows/idea-gradle-build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idea-gradle-build-and-test.yml b/.github/workflows/idea-gradle-build-and-test.yml index 69bb171..9dac5ff 100644 --- a/.github/workflows/idea-gradle-build-and-test.yml +++ b/.github/workflows/idea-gradle-build-and-test.yml @@ -23,7 +23,7 @@ jobs: chmod +x gradlew ./gradlew test buildPlugin - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: KerboScript(kOS).zip path: IDEA/build/distributions/KerboScript(kOS).zip From 5d71d4680e95acbb4ded0be272f95ed6851e8ba8 Mon Sep 17 00:00:00 2001 From: valery-labuzhsky Date: Mon, 23 Sep 2024 11:52:42 +0100 Subject: [PATCH 3/4] [IDEA] fix github actions --- .github/workflows/idea-gradle-build-and-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/idea-gradle-build-and-test.yml b/.github/workflows/idea-gradle-build-and-test.yml index 9dac5ff..020ec64 100644 --- a/.github/workflows/idea-gradle-build-and-test.yml +++ b/.github/workflows/idea-gradle-build-and-test.yml @@ -12,9 +12,9 @@ jobs: # Note: if we wanted, we could expand this to test on multiple OS's runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: '17' - name: Run tests and build plugin From e019a814ad836efac5982088e581e950adba3e70 Mon Sep 17 00:00:00 2001 From: valery-labuzhsky Date: Mon, 23 Sep 2024 11:54:18 +0100 Subject: [PATCH 4/4] [IDEA] fix github actions --- .github/workflows/idea-gradle-build-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/idea-gradle-build-and-test.yml b/.github/workflows/idea-gradle-build-and-test.yml index 020ec64..d073874 100644 --- a/.github/workflows/idea-gradle-build-and-test.yml +++ b/.github/workflows/idea-gradle-build-and-test.yml @@ -16,6 +16,7 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v4 with: + distribution: 'temurin' java-version: '17' - name: Run tests and build plugin run: |