Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove headless from development branch #414

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 1 addition & 38 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
import org.jetbrains.intellij.platform.gradle.tasks.RunIdeTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileOutputStream
import java.net.URL
Expand Down Expand Up @@ -236,7 +235,7 @@ intellijPlatform {
}
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix"
"TemplateWordInPluginId,ForbiddenPluginIdPrefix",
)
}
}
Expand Down Expand Up @@ -416,40 +415,4 @@ tasks.register<Copy>("copyJUnitRunnerLib") {
*/
fun String?.orDefault(default: String): String = this ?: default

/**
* This code sets up a Gradle task for running the plugin in headless mode
*
* @param root The root directory of the project under test.
* @param file The file containing unit under test.
* @param cut The class under test.
* @param cp The classpath of the project.
* @param llm The model used for the test generation task.
* @param token The token for using LLM.
* @param prompt a txt file containing the LLM's prompt template
* @param out The output directory for the project.
* @param enableCoverage flag to enable/disable coverage computation
*/
tasks.create<RunIdeTask>("headless") {
val root: String? by project
val file: String? by project
val cut: String? by project
val cp: String? by project
val junitv: String? by project
val llm: String? by project
val token: String? by project
val prompt: String? by project
val out: String? by project
val enableCoverage: String? by project

args = listOfNotNull("testspark", root, file, cut, cp, junitv, llm, token, prompt, out, enableCoverage.orDefault("false"))

jvmArgs(
"-Xmx16G",
"-Djava.awt.headless=true",
"--add-exports",
"java.base/jdk.internal.vm=ALL-UNNAMED",
"-Didea.system.path",
)
}

fun spaceCredentialsProvided() = spaceUsername.isNotEmpty() && spacePassword.isNotEmpty()
31 changes: 0 additions & 31 deletions runTestSparkHeadless.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.ex.ApplicationManagerEx
import com.intellij.openapi.progress.util.ProgressIndicatorBase
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.openapi.startup.StartupManager
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.LocalFileSystem
Expand All @@ -25,6 +27,7 @@ import org.jetbrains.plugins.gradle.GradleCommandLineProjectConfigurator
import org.slf4j.LoggerFactory
import java.nio.file.Path
import java.util.function.Predicate
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine

class ProjectConfiguratorException : Exception {
Expand Down Expand Up @@ -158,18 +161,14 @@ object ProjectApplicationUtils {

private fun closeProject(project: Project) {
logger.info("Closing project $project...")
ApplicationManager.getApplication().assertIsNonDispatchThread()
// ToDo: move headless mode to another branch
// ApplicationManager.getApplication().invokeAndWait {
// ProjectManagerEx.getInstanceEx().forceCloseProject(project)
// }
ApplicationManager.getApplication().invokeAndWait {
ProjectManagerEx.getInstanceEx().forceCloseProject(project)
}
}

private suspend fun waitAllStartupActivitiesPassed(project: Project): Unit = suspendCoroutine {
logger.info("Waiting all startup activities passed $project...")
// ToDo: move headless mode to another branch
// StartupManager.getInstance(project).runAfterOpened { it.resume(Unit) }
waitForInvokeLaterActivities()
StartupManager.getInstance(project).runAfterOpened { it.resume(Unit) }
}

/**
Expand Down
Loading
Loading