From e06a3ee0e29f3512621d7d19bc953ca9b137a87e Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Fri, 11 Oct 2024 11:42:14 +0200 Subject: [PATCH 01/20] Update gradle properties and version --- gradle.properties | 8 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 29c32f252..175b30baa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,21 +11,21 @@ evosuiteVersion = 1.0.5 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. pluginSinceBuild = 241 -pluginUntilBuild = 241.* +pluginUntilBuild = 242.* # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties platformType = IC -platformVersion = 2024.1 +platformVersion = 2024.2.3 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 -platformPlugins = com.intellij.java, org.jetbrains.kotlin, maven, gradle +platformPlugins = com.intellij.java, org.jetbrains.kotlin, org.jetbrains.idea.maven, com.intellij.gradle # Java language level used to compile sources and to generate the files for - Java 17 is required since 2023.1 javaVersion = 17 # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 8.2.1 +gradleVersion = 8.10.2 # Opt-out flag for bundling Kotlin standard library. # See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702f..0d1842103 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-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 61de6a9be675ac71172c3cceea97a9b8aaebb442 Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Fri, 11 Oct 2024 11:42:41 +0200 Subject: [PATCH 02/20] Update root project's build.gradle.kts --- build.gradle.kts | 86 ++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b210fe2ab..c32a1fcfb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.intellij.tasks.RunIdeTask +import org.jetbrains.intellij.platform.gradle.tasks.RunIdeTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.io.FileOutputStream import java.net.URL @@ -7,6 +7,7 @@ import java.nio.file.Files import java.nio.file.Paths import java.nio.file.StandardCopyOption import java.util.zip.ZipInputStream +import org.jetbrains.intellij.platform.gradle.TestFrameworkType fun properties(key: String) = project.findProperty(key).toString() @@ -25,7 +26,9 @@ plugins { // Kotlin support id("org.jetbrains.kotlin.jvm") version "1.9.0" // Gradle IntelliJ Plugin - id("org.jetbrains.intellij") version "1.15.0" + id("org.jetbrains.intellij.platform") version "2.1.0" + // Gradle IntelliJ Plugin Migration Help (uncomment it for migration tips) +// id("org.jetbrains.intellij.platform.migration") version "2.1.0" // Gradle Changelog Plugin id("org.jetbrains.changelog") version "2.1.2" // Gradle Qodana Plugin @@ -37,6 +40,10 @@ version = properties("pluginVersion") // Configure project's dependencies repositories { mavenCentral() + // this part is mandatory for all modules for platform version 2 + intellijPlatform { + defaultRepositories() + } maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") maven("https://www.jetbrains.com/intellij-repository/snapshots") @@ -66,6 +73,13 @@ if (spaceCredentialsProvided()) { usingSourceSet(hasGrazieAccess) } + // Add the dependencies for the new source set + dependencies { + add(hasGrazieAccess.implementationConfigurationName, kotlin("stdlib")) + add(hasGrazieAccess.implementationConfigurationName, "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") + add(hasGrazieAccess.implementationConfigurationName, "org.jetbrains.research:grazie-test-generation:$grazieTestGenerationVersion") + } + tasks.register("checkCredentials") { configurations.detachedConfiguration( dependencies.create("org.jetbrains.research:grazie-test-generation:$grazieTestGenerationVersion"), @@ -77,7 +91,7 @@ if (spaceCredentialsProvided()) { } // add build of new source set as the part of UI testing - tasks.prepareUiTestingSandbox.configure { + tasks.prepareTestSandbox.configure { dependsOn(hasGrazieAccess.jarTaskName) from(tasks.getByName(hasGrazieAccess.jarTaskName).outputs.files.asPath) { into("TestSpark/lib") } @@ -99,6 +113,20 @@ if (spaceCredentialsProvided()) { } dependencies { + // Check platform V2 documentation for more details: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html + intellijPlatform { + // make a custom version of IDEA + create(properties("platformType"), properties("platformVersion")) + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + bundledPlugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) + + pluginVerifier() + zipSigner() + instrumentationTools() + + testFramework(TestFrameworkType.Platform) + } + implementation(files("lib/evosuite-${properties("evosuiteVersion")}.jar")) implementation(files("lib/standalone-runtime.jar")) implementation(files("lib/jacocoagent.jar")) @@ -169,23 +197,24 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-test:1.8.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") - - if (spaceCredentialsProvided()) { - // Dependencies for hasGrazieAccess variant - "hasGrazieAccessImplementation"(kotlin("stdlib")) - "hasGrazieAccessImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") - "hasGrazieAccessImplementation"("org.jetbrains.research:grazie-test-generation:$grazieTestGenerationVersion") - } } -// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin -intellij { - pluginName.set(properties("pluginName")) - version.set(properties("platformVersion")) - type.set(properties("platformType")) +// Configure Gradle IntelliJ Plugin - read more: // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin +intellijPlatform { + pluginConfiguration{ + name = properties("pluginName") + version = properties("platformVersion") - // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) + ideaVersion { + sinceBuild = properties("pluginSinceBuild") + untilBuild = properties("pluginUntilBuild") + } + } + + publishing{ + token = System.getenv("PUBLISH_TOKEN") + channels = listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()) + } } // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin @@ -233,10 +262,6 @@ tasks { } patchPluginXml { - version.set(properties("pluginVersion")) - sinceBuild.set(properties("pluginSinceBuild")) - untilBuild.set(properties("pluginUntilBuild")) - // Extract the section from README.md and provide for the plugin's manifest pluginDescription.set( projectDir.resolve("README.md").readText().lines().run { @@ -260,20 +285,6 @@ tasks { ) } - // Configure UI tests plugin - // Read more: https://github.com/JetBrains/intellij-ui-test-robot - runIdeForUiTests { - systemProperty("robot-server.port", "8082") - systemProperty("ide.mac.message.dialogs.as.sheets", "false") - systemProperty("jb.privacy.policy.text", "") - systemProperty("jb.consents.confirmation.enabled", "false") - systemProperty("idea.trust.all.projects", "true") - systemProperty("ide.show.tips.on.startup.default.value", "false") - systemProperty("jb.consents.confirmation.enabled", "false") - systemProperty("ide.mac.file.chooser.native", "false") - systemProperty("apple.laf.useScreenMenuBar", "false") - } - signPlugin { certificateChain.set(System.getenv("CERTIFICATE_CHAIN").trimIndent()) privateKey.set(System.getenv("PRIVATE_KEY").trimIndent()) @@ -282,11 +293,6 @@ tasks { publishPlugin { dependsOn("patchChangelog") - token.set(System.getenv("PUBLISH_TOKEN")) - // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 - // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: - // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())) } } From efe28042a0b67c35446a38905aa973c5f010fbaa Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Fri, 11 Oct 2024 11:45:04 +0200 Subject: [PATCH 03/20] Update other modules' build.gradle.kts --- java/build.gradle.kts | 27 ++++++++++++++++----------- kotlin/build.gradle.kts | 22 +++++++++++++++++----- langwrappers/build.gradle.kts | 26 +++++++++++++++++++++----- 3 files changed, 54 insertions(+), 21 deletions(-) diff --git a/java/build.gradle.kts b/java/build.gradle.kts index a499d11b5..f90007a00 100644 --- a/java/build.gradle.kts +++ b/java/build.gradle.kts @@ -1,33 +1,38 @@ plugins { kotlin("jvm") - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform") } repositories { mavenCentral() + intellijPlatform { + defaultRepositories() + } } dependencies { + intellijPlatform { + create(rootProject.properties["platformType"].toString(), rootProject.properties["platformVersion"].toString()) + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + bundledPlugins(listOf("com.intellij.java")) + + instrumentationTools() + } implementation(kotlin("stdlib")) implementation(project(":langwrappers")) // Interfaces that cover language-specific logic implementation(project(":core")) } -intellij { - rootProject.properties["platformVersion"]?.let { version.set(it.toString()) } - plugins.set(listOf("java")) +intellijPlatform { + pluginConfiguration { + rootProject.properties["platformVersion"]?.let { version = it.toString() } + } } tasks.named("verifyPlugin") { enabled = false } tasks.named("runIde") { enabled = false } -tasks.named("runPluginVerifier") { enabled = false } - -tasks { - buildSearchableOptions { - enabled = false - } -} +tasks.named("prepareJarSearchableOptions") { enabled = false } kotlin { jvmToolchain(rootProject.properties["jvmToolchainVersion"].toString().toInt()) diff --git a/kotlin/build.gradle.kts b/kotlin/build.gradle.kts index 903631aa9..8cd1fa6f8 100644 --- a/kotlin/build.gradle.kts +++ b/kotlin/build.gradle.kts @@ -1,27 +1,39 @@ plugins { kotlin("jvm") - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform") } repositories { mavenCentral() + intellijPlatform { + defaultRepositories() + } } dependencies { + + intellijPlatform { + create(rootProject.properties["platformType"].toString(), rootProject.properties["platformVersion"].toString()) + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + bundledPlugins(listOf("com.intellij.java", "org.jetbrains.kotlin")) + + instrumentationTools() + } implementation(kotlin("stdlib")) implementation(project(":langwrappers")) // Interfaces that cover language-specific logic implementation(project(":core")) } -intellij { - rootProject.properties["platformVersion"]?.let { version.set(it.toString()) } - plugins.set(listOf("java", "org.jetbrains.kotlin")) +intellijPlatform { + pluginConfiguration { + rootProject.properties["platformVersion"]?.let { version = it.toString() } + } } tasks.named("verifyPlugin") { enabled = false } tasks.named("runIde") { enabled = false } -tasks.named("runPluginVerifier") { enabled = false } +tasks.named("prepareJarSearchableOptions") { enabled = false } tasks { buildSearchableOptions { diff --git a/langwrappers/build.gradle.kts b/langwrappers/build.gradle.kts index 317debb35..30b0fed4c 100644 --- a/langwrappers/build.gradle.kts +++ b/langwrappers/build.gradle.kts @@ -1,26 +1,42 @@ plugins { kotlin("jvm") - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform") } repositories { mavenCentral() + intellijPlatform { + defaultRepositories() + } } dependencies { + + intellijPlatform { + create(rootProject.properties["platformType"].toString(), rootProject.properties["platformVersion"].toString()) + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + bundledPlugins(listOf("com.intellij.java")) + + instrumentationTools() + } implementation(kotlin("stdlib")) implementation(project(":core")) } -intellij { - rootProject.properties["platformVersion"]?.let { version.set(it.toString()) } - plugins.set(listOf("java")) +intellijPlatform { + pluginConfiguration { + rootProject.properties["platformVersion"]?.let { version = it.toString() } + } +// apply(plugin = "java") +// // Apply more plugins if necessary +// apply(plugin = "kotlin") } tasks.named("verifyPlugin") { enabled = false } tasks.named("runIde") { enabled = false } -tasks.named("runPluginVerifier") { enabled = false } +tasks.named("prepareJarSearchableOptions") { enabled = false } +//tasks.named("runPluginVerifier") { enabled = false } kotlin { jvmToolchain(rootProject.properties["jvmToolchainVersion"].toString().toInt()) From 801196cf9b14e131e29b9fe4615f8ba655c99a4e Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Fri, 11 Oct 2024 11:49:43 +0200 Subject: [PATCH 04/20] Resolve ktlint issues --- build.gradle.kts | 6 +++--- langwrappers/build.gradle.kts | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c32a1fcfb..add6caef9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.platform.gradle.TestFrameworkType import org.jetbrains.intellij.platform.gradle.tasks.RunIdeTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.io.FileOutputStream @@ -7,7 +8,6 @@ import java.nio.file.Files import java.nio.file.Paths import java.nio.file.StandardCopyOption import java.util.zip.ZipInputStream -import org.jetbrains.intellij.platform.gradle.TestFrameworkType fun properties(key: String) = project.findProperty(key).toString() @@ -201,7 +201,7 @@ dependencies { // Configure Gradle IntelliJ Plugin - read more: // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin intellijPlatform { - pluginConfiguration{ + pluginConfiguration { name = properties("pluginName") version = properties("platformVersion") @@ -211,7 +211,7 @@ intellijPlatform { } } - publishing{ + publishing { token = System.getenv("PUBLISH_TOKEN") channels = listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()) } diff --git a/langwrappers/build.gradle.kts b/langwrappers/build.gradle.kts index 30b0fed4c..336bca55d 100644 --- a/langwrappers/build.gradle.kts +++ b/langwrappers/build.gradle.kts @@ -36,7 +36,6 @@ intellijPlatform { tasks.named("verifyPlugin") { enabled = false } tasks.named("runIde") { enabled = false } tasks.named("prepareJarSearchableOptions") { enabled = false } -//tasks.named("runPluginVerifier") { enabled = false } kotlin { jvmToolchain(rootProject.properties["jvmToolchainVersion"].toString().toInt()) From 6d04ca4dcb75a6a3225e2ddd2ead9d7c4bd2902e Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Fri, 11 Oct 2024 11:51:02 +0200 Subject: [PATCH 05/20] Fix parsing default setting value issue in the new version --- .../research/testspark/bundles/llm/LLMDefaultsBundle.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/org/jetbrains/research/testspark/bundles/llm/LLMDefaultsBundle.kt b/src/main/kotlin/org/jetbrains/research/testspark/bundles/llm/LLMDefaultsBundle.kt index 4c3377fd7..81cd2f0e3 100644 --- a/src/main/kotlin/org/jetbrains/research/testspark/bundles/llm/LLMDefaultsBundle.kt +++ b/src/main/kotlin/org/jetbrains/research/testspark/bundles/llm/LLMDefaultsBundle.kt @@ -13,5 +13,5 @@ object LLMDefaultsBundle : DynamicBundle(LLMBundlePaths.defaults) { * Gets the requested default value. */ @Nls - fun get(@PropertyKey(resourceBundle = LLMBundlePaths.defaults) key: String): String = getMessage(key) + fun get(@PropertyKey(resourceBundle = LLMBundlePaths.defaults) key: String): String = getMessage(key).split("|").last() } From bae0d4588f837953db7517894a5e91ce8f3999c2 Mon Sep 17 00:00:00 2001 From: "Pouria.Derakhshanfar" Date: Fri, 11 Oct 2024 11:51:36 +0200 Subject: [PATCH 06/20] Update Run IDE for UI test run config based on new tasks --- .run/Run IDE for UI Tests.run.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.run/Run IDE for UI Tests.run.xml b/.run/Run IDE for UI Tests.run.xml index 47eabffa9..ebe72fecf 100644 --- a/.run/Run IDE for UI Tests.run.xml +++ b/.run/Run IDE for UI Tests.run.xml @@ -5,13 +5,13 @@