-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- CMake file is generated, it assembles tests similar to makefiles generated by UTBOT but simpler - Wrappers are sent to client in the same way as stubs - CMake file is adopted in CLion: the tests subdir is added to the root CMakeLists.txt and GTest is optionally installed.
- Loading branch information
Showing
75 changed files
with
1,238 additions
and
153 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...n-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/actions/SyncWrappersAndStubsAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.utbot.cpp.clion.plugin.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import org.utbot.cpp.clion.plugin.utils.client | ||
|
||
class SyncWrappersAndStubsAction: UTBotBaseAction() { | ||
override fun actionPerformed(e: AnActionEvent) { | ||
e.client.syncWrappersAnsStubs() | ||
} | ||
|
||
override fun updateIfEnabled(e: AnActionEvent) { | ||
e.presentation.isEnabledAndVisible = e.project != null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...main/kotlin/org/utbot/cpp/clion/plugin/client/handlers/testsStreamHandler/CMakePrinter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.utbot.cpp.clion.plugin.client.handlers.testsStreamHandler | ||
|
||
class CMakePrinter(private val currentCMakeListsContent: String) { | ||
private val ss = StringBuilder() | ||
var isEmpty = true | ||
private set | ||
|
||
init { | ||
ss.append("\n") | ||
startUTBotSection() | ||
} | ||
|
||
private fun add(string: String) { | ||
ss.append(string) | ||
ss.append("\n") | ||
} | ||
|
||
fun startUTBotSection() { | ||
add("#utbot_section_start") | ||
} | ||
|
||
fun addDownloadGTestSection() { | ||
isEmpty = false | ||
add( | ||
""" | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG release-1.12.1 | ||
) | ||
# For Windows: Prevent overriding the parent project's compiler/linker settings | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
enable_testing() | ||
include(GoogleTest) | ||
""".trimIndent() | ||
) | ||
} | ||
|
||
fun addSubdirectory(dirRelativePath: String) { | ||
isEmpty = false | ||
val addDirectoryInstruction = "add_subdirectory($dirRelativePath)" | ||
if (!currentCMakeListsContent.contains(addDirectoryInstruction)) | ||
add(addDirectoryInstruction) | ||
} | ||
|
||
fun get(): String { | ||
return ss.toString() + "#utbot_section_end\n" | ||
} | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
...org/utbot/cpp/clion/plugin/client/handlers/testsStreamHandler/ShouldInstallGTestDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.utbot.cpp.clion.plugin.client.handlers.testsStreamHandler | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.ui.DialogWrapper | ||
import com.intellij.ui.dsl.builder.panel | ||
import javax.swing.JComponent | ||
import org.utbot.cpp.clion.plugin.UTBot | ||
|
||
class ShouldInstallGTestDialog(project: Project) : DialogWrapper(project) { | ||
init { | ||
init() | ||
title = "UTBot: GTest Install" | ||
} | ||
|
||
override fun createCenterPanel(): JComponent { | ||
return panel { | ||
row(UTBot.message("dialog.should.install.gtest")) {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.