diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56e9..ef98d9f49 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,10 @@ - + + + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index e14ff4d59..415fec09a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,7 @@ import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.kotlin.dsl.register // Specify UTF-8 for all compilations so we avoid Windows-1252. allprojects { @@ -102,23 +103,26 @@ dependencies { // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms androidStudio(ideaVersion) testFramework(TestFrameworkType.Platform) + testFramework(TestFrameworkType.Starter) // Plugin dependency documentation: // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins // https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#project-setup - bundledPlugins(immutableListOf( - "com.google.tools.ij.aiplugin", - "com.intellij.java", - "com.intellij.properties", - "JUnit", - "Git4Idea", - "org.jetbrains.kotlin", - "org.jetbrains.plugins.gradle", - "org.jetbrains.plugins.yaml", - "org.intellij.intelliLang", - "org.jetbrains.android", - "com.android.tools.idea.smali" - )) + bundledPlugins( + immutableListOf( + "com.google.tools.ij.aiplugin", + "com.intellij.java", + "com.intellij.properties", + "JUnit", + "Git4Idea", + "org.jetbrains.kotlin", + "org.jetbrains.plugins.gradle", + "org.jetbrains.plugins.yaml", + "org.intellij.intelliLang", + "org.jetbrains.android", + "com.android.tools.idea.smali" + ) + ) plugin("Dart:$dartPluginVersion") if (sinceBuildInput == "243" || sinceBuildInput == "251") { @@ -136,6 +140,16 @@ dependencies { testImplementation("com.google.guava:guava:32.0.1-jre") testImplementation("com.google.code.gson:gson:2.10.1") testImplementation("junit:junit:4.13.2") + + // Starter Framework + testImplementation("com.jetbrains.intellij.tools:ide-starter-squashed:LATEST-EAP-SNAPSHOT") + testImplementation("com.jetbrains.intellij.tools:ide-starter-junit5:LATEST-EAP-SNAPSHOT") + + testImplementation("com.jetbrains.intellij.tools:ide-starter-driver:LATEST-EAP-SNAPSHOT") + testImplementation("com.jetbrains.intellij.driver:driver-client:LATEST-EAP-SNAPSHOT") + testImplementation("com.jetbrains.intellij.driver:driver-sdk:LATEST-EAP-SNAPSHOT") + testImplementation("com.jetbrains.intellij.driver:driver-model:LATEST-EAP-SNAPSHOT") + implementation( fileTree( mapOf( @@ -146,6 +160,89 @@ dependencies { ) } +sourceSets { + main { + java.srcDirs( + listOf( + "flutter-idea/src", + "flutter-idea/third_party/vmServiceDrivers" + ) + ) + // Add kotlin.srcDirs if we start using Kotlin in the main plugin. + resources.srcDirs( + listOf( + "flutter-idea/src", + "resources" + ) + ) + java.srcDirs( + listOf( + "flutter-studio/src", + "flutter-studio/third_party/vmServiceDrivers" + ) + ) + } + test { +// kotlin.srcDir("src/integrationTest/kotlin") + java.srcDirs( + listOf( + "flutter-idea/src", + "flutter-idea/testSrc/unit", + "flutter-idea/third_party/vmServiceDrivers" + ) + ) + resources.srcDirs( + listOf( + "resources", + "flutter-idea/testData", + "flutter-idea/testSrc/unit" + ) + ) + } + + create("integrationTest") { +// kotlin.srcDir("src/integrationTest/kotlin") +// java.srcDirs( +// listOf( +// "flutter-idea/src", +// "flutter-idea/testSrc/unit", +// "flutter-idea/third_party/vmServiceDrivers" +// ) +// ) +// // It's good practice to also have a resources directory +// resources.srcDir("src/integrationTest/resources") +// +// +// // This gives your tests access to your main app's code. +// compileClasspath += sourceSets.main.get().output +// compileClasspath += sourceSets.test.get().output +// runtimeClasspath += sourceSets.main.get().output +// runtimeClasspath += sourceSets.test.get().output + compileClasspath += configurations.getByName("testCompileClasspath") + runtimeClasspath += configurations.getByName("testRuntimeClasspath") +// compileClasspath += configurations.getByName("integrationTestImplementation") + + } +} + +//configurations { +// // Get the configuration that was automatically created for the 'integrationTest' source set... +// getByName("integrationTestImplementation") { +// // ...and tell it to inherit all dependencies from the regular 'testImplementation'. +// // This is the crucial link that provides the IntelliJ test framework. +// extendsFrom(getByName("testImplementation")) +// } +//} + +val integrationTestImplementation by configurations.getting { + extendsFrom(configurations.testImplementation.get()) +} + +dependencies { + integrationTestImplementation("org.junit.jupiter:junit-jupiter:5.7.1") + integrationTestImplementation("org.kodein.di:kodein-di-jvm:7.20.2") + integrationTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.10.1") +} intellijPlatform { pluginConfiguration { @@ -194,44 +291,13 @@ intellijPlatform { } } -sourceSets { - main { - java.srcDirs( - listOf( - "flutter-idea/src", - "flutter-idea/third_party/vmServiceDrivers" - ) - ) - // Add kotlin.srcDirs if we start using Kotlin in the main plugin. - resources.srcDirs( - listOf( - "flutter-idea/src", - "resources" - ) - ) - java.srcDirs( - listOf( - "flutter-studio/src", - "flutter-studio/third_party/vmServiceDrivers" - ) - ) - } - test { - java.srcDirs( - listOf( - "flutter-idea/src", - "flutter-idea/testSrc/unit", - "flutter-idea/third_party/vmServiceDrivers" - ) - ) - resources.srcDirs( - listOf( - "resources", - "flutter-idea/testData", - "flutter-idea/testSrc/unit" - ) - ) - } +val integrationTest = tasks.register("integrationTest") { + val integrationTestSourceSet = sourceSets.getByName("integrationTest") + testClassesDirs = integrationTestSourceSet.output.classesDirs + classpath = integrationTestSourceSet.runtimeClasspath + systemProperty("path.to.build.plugin", tasks.prepareSandbox.get().pluginDirectory.get().asFile) + useJUnitPlatform() + dependsOn(tasks.prepareSandbox) } // Documentation for printProductsReleases: @@ -269,9 +335,39 @@ tasks { tasks.register("printCompileClasspath") { doLast { println("--- Begin Compile Classpath ---") - configurations.getByName("compileClasspath").forEach { file -> - println(file.absolutePath) +// configurations.getByName("compileClasspath").forEach { file -> +// println(file.absolutePath) +// } + println("\n--- Integration Test Compile Classpath ---") + sourceSets.getByName("integrationTest").compileClasspath.forEach { file -> + println(file.name) } +// +// println("\n--- Main Compile Classpath ---") +// sourceSets.main.get().compileClasspath.forEach { file -> +// println(file.name) +// } + +// println("\n--- Test Compile Classpath ---") +// sourceSets.test.get().compileClasspath.forEach { file -> +// println(file.name) +// } + println("--- End Compile Classpath ---") } } + +tasks.register("printAllConfigurations") { + group = "help" + description = "Prints all configurations and their properties." + + doLast { + println("--- All Project Configurations ---") + project.configurations.all { + println("Name: ${this.name}") + println(" - Can be resolved: ${this.isCanBeResolved}") + println(" - Extends from: ${this.extendsFrom.map { it.name }}") + println("") + } + } +} diff --git a/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java b/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java index 7d59a7db1..a35a203c8 100644 --- a/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java +++ b/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java @@ -177,7 +177,7 @@ public void flushFlutterErrorQueue() { private static final ArrayList emptyList = new ArrayList<>(); /** - * Pretty print the error using the available console syling attributes. + * Pretty print the error using the available console styling attributes. */ private void processFlutterErrorEvent(@NotNull DiagnosticsNode diagnosticsNode) { final String description = " " + diagnosticsNode + " "; diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index e792c0611..0372b80c5 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -23,7 +23,7 @@ Custom Languages SNAPSHOT - + com.intellij.modules.platform com.intellij.modules.lang @@ -45,7 +45,7 @@ - com.intellij.modules.androidstudio + com.android.tools.apk diff --git a/src/integrationTest/kotlin/PluginTest.kt b/src/integrationTest/kotlin/PluginTest.kt new file mode 100644 index 000000000..4ef331554 --- /dev/null +++ b/src/integrationTest/kotlin/PluginTest.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2025 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +import com.intellij.ide.starter.ci.CIServer +import com.intellij.ide.starter.ci.NoCIServer +import com.intellij.ide.starter.di.di +import com.intellij.ide.starter.driver.engine.runIdeWithDriver +import com.intellij.ide.starter.ide.IdeProductProvider +import com.intellij.ide.starter.models.TestCase +import com.intellij.ide.starter.plugins.PluginConfigurator +import com.intellij.ide.starter.project.GitHubProject +import com.intellij.ide.starter.runner.Starter +import org.junit.Test + +class PluginTest { + @Test + fun simpleTestWithoutProject() { + println("In integration test") +// Starter.newContext( +// testName = "testExample", +// TestCase(IdeProductProvider.IC, projectInfo = NoProject) +// .withVersion("2024.3") +// ).apply { +// val pathToPlugin = System.getProperty("path.to.build.plugin") +// PluginConfigurator(this).installPluginFromFolder(File(pathToPlugin)) +// }.runIdeWithDriver().useDriverAndCloseIde { +// } + } +} \ No newline at end of file