Skip to content

Commit a0f1871

Browse files
authored
Path refactoring (#677)
* Name refactoring * Add option to CLI
1 parent d81bf92 commit a0f1871

File tree

63 files changed

+587
-482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+587
-482
lines changed

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/actions/AskServerToGenerateBuildDir.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import org.utbot.cpp.clion.plugin.utils.activeProject
88
import org.utbot.cpp.clion.plugin.utils.client
99
import testsgen.Testgen
1010

11-
class AskServerToGenerateBuildDir : UTBotBaseAction(UTBot.message("projectConfigure.generate.buildDir")) {
11+
class AskServerToGenerateBuildDir : UTBotBaseAction(UTBot.message("projectConfigure.generate.buildRelDir")) {
1212

1313
override fun actionPerformed(e: AnActionEvent) = CreateBuildDirRequest(
1414
GrpcRequestBuilderFactory(e.activeProject()).createProjectConfigRequestBuilder(Testgen.ConfigMode.CREATE_BUILD_DIR),

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/client/requests/CreateBuildFolderRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CreateBuildDirRequest(
2626
CreateBuildDirHandler(
2727
client,
2828
this,
29-
UTBot.message("requests.buildDir.description.progress"),
29+
UTBot.message("requests.buildRelDir.description.progress"),
3030
cancellationJob
3131
).handle()
3232
}

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/grpc/GrpcRequestBuilderFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GrpcRequestBuilderFactory(
2121
project.name,
2222
project.path,
2323
project.settings.storedSettings.testDirRelativePath,
24-
project.settings.storedSettings.buildDirRelativePath
24+
project.settings.storedSettings.buildDirRelPath
2525
)
2626
}
2727

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/grpc/GrpcRequestBuildersImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal data class ProjectContextBuilder(
1212
val projectName: String,
1313
val projectPath: String,
1414
val testDirRelativePath: String,
15-
val buildDirRelativePath: String
15+
val buildDirRelPath: String
1616
) : GrpcRequestBuilder<Testgen.ProjectContext> {
1717
override fun build(remoteMapping: RemoteMapping): Testgen.ProjectContext {
1818
val projectNioPath = Paths.get(projectPath) // project path is not set by user, assuming it is valid
@@ -29,7 +29,7 @@ internal data class ProjectContextBuilder(
2929
UTBot.message("settings.project.testsDir.wrong")
3030
)
3131
)
32-
.setBuildDirRelativePath(buildDirRelativePath)
32+
.setBuildDirRelPath(buildDirRelPath)
3333
.setProjectName(projectName)
3434
.setProjectPath(remoteMapping.convertToRemote(projectPath, UTBot.message("projectPath.wrong.conversion")))
3535
.build()

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/settings/UTBotAllProjectSettings.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ class UTBotAllProjectSettings(val project: Project) {
2424
val buildDirPath: Path
2525
get() {
2626
try {
27-
return Paths.get(project.path).resolve(storedSettings.buildDirRelativePath)
27+
return Paths.get(project.path).resolve(storedSettings.buildDirRelPath)
2828
} catch (e: InvalidPathException) {
2929
throw IllegalPathException(
3030
UTBot.message(
3131
"paths.invalid",
3232
"relative path to build dir",
33-
storedSettings.buildDirRelativePath
33+
storedSettings.buildDirRelPath
3434
),
35-
storedSettings.buildDirRelativePath
35+
storedSettings.buildDirRelPath
3636
)
3737
}
3838
}
@@ -82,7 +82,7 @@ class UTBotAllProjectSettings(val project: Project) {
8282

8383
fun predictPaths() {
8484
storedSettings.remotePath = UTBotProjectStoredSettings.REMOTE_PATH_VALUE_FOR_LOCAL_SCENARIO
85-
storedSettings.buildDirRelativePath = UTBotProjectStoredSettings.DEFAULT_RELATIVE_PATH_TO_BUILD_DIR
85+
storedSettings.buildDirRelPath = UTBotProjectStoredSettings.DEFAULT_RELATIVE_PATH_TO_BUILD_DIR
8686
storedSettings.targetPath = UTBotTarget.autoTarget.path
8787
}
8888

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/settings/UTBotConfigurable.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
134134
}
135135

136136
private fun Panel.createPathsSettings() {
137-
row(UTBot.message("settings.project.buildDir")) {
138-
textField().bindText(settings::buildDirRelativePath).columns(COLUMNS_LARGE)
137+
row(UTBot.message("settings.project.buildRelDir")) {
138+
textField().bindText(settings::buildDirRelPath).columns(COLUMNS_LARGE)
139139
.validateInput(ValidationCondition(UTBot.message("validation.not.empty")) {
140140
it.text.stripLeadingSlashes().isNotEmpty()
141141
})

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/settings/UTBotProjectStoredSettings.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class UTBotProjectStoredSettings(val project: Project) : PersistentStateComponen
2929

3030
// serialized by the ide
3131
data class State(
32-
var buildDirRelativePath: String = DEFAULT_RELATIVE_PATH_TO_BUILD_DIR,
32+
var buildDirRelPath: String = DEFAULT_RELATIVE_PATH_TO_BUILD_DIR,
3333
var testsDirRelativePath: String = DEFAULT_TESTS_DIR_RELATIVE_PATH,
3434
var targetPath: String = UTBotTarget.autoTarget.path,
3535
var remotePath: String = REMOTE_PATH_VALUE_FOR_LOCAL_SCENARIO,
@@ -44,7 +44,7 @@ class UTBotProjectStoredSettings(val project: Project) : PersistentStateComponen
4444
var isPluginEnabled: Boolean = false
4545
) {
4646
fun fromSettingsModel(model: UTBotSettingsModel) {
47-
buildDirRelativePath = model.projectSettings.buildDirRelativePath
47+
buildDirRelPath = model.projectSettings.buildDirRelPath
4848
testsDirRelativePath = model.projectSettings.testsDirRelativePath
4949
targetPath = model.projectSettings.targetPath
5050
remotePath = model.projectSettings.remotePath
@@ -129,10 +129,10 @@ class UTBotProjectStoredSettings(val project: Project) : PersistentStateComponen
129129
else
130130
Paths.get(project.path).relativize(Paths.get(targetPath)).toString()
131131

132-
var buildDirRelativePath: String
133-
get() = myState.buildDirRelativePath.stripLeadingSlashes()
132+
var buildDirRelPath: String
133+
get() = myState.buildDirRelPath.stripLeadingSlashes()
134134
set(value) {
135-
myState.buildDirRelativePath = value
135+
myState.buildDirRelPath = value
136136
}
137137

138138
var isPluginEnabled: Boolean

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/ui/wizard/steps/BuildOptionsStep.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BuildOptionsStep(parentDisposable: Disposable, private val settingsModel:
1818
addHtml("media/options_wizard_text.html")
1919
panel {
2020
row("Relative path to Build directory") {
21-
textField().bindText(settingsModel.projectSettings::buildDirRelativePath).columns(COLUMNS_LARGE)
21+
textField().bindText(settingsModel.projectSettings::buildDirRelPath).columns(COLUMNS_LARGE)
2222
.validateWith(ValidationCondition(UTBot.message("validation.not.empty")) { it.text.isNotEmpty() })
2323
}
2424

clion-plugin/src/main/resources/messages/UTBot.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
projectConfigure.configure=Configure Project
2-
projectConfigure.generate.buildDir=Generate build directory
2+
projectConfigure.generate.buildRelDir=Generate build directory
33
projectConfigure.generate.json=Generate Missing JSON Files
44
projectConfigure.reconfigure=Reset cache and configure project
55
wizard.show=Quickstart wizard
66
settings.project.sourcePaths=Source paths:
7-
settings.project.buildDir=Build directory:
7+
settings.project.buildRelDir=Build directory:
88
settings.project.target=target path:
99
settings.project.target.wrong.conversion=Possibly wrong target path. Could not create relative path from remote path
1010
settings.project.testsDir=Tests directory:
@@ -28,7 +28,7 @@ requests.predicate.description.progress=Generating for predicate...
2828
requests.coverage.description.progress=Requesting results and coverage...
2929
requests.check.description.progress=Checking project configuration...
3030
requests.json.description.progress=Generating json files...
31-
requests.buildDir.description.progress=Creating build directory...
31+
requests.buildRelDir.description.progress=Creating build directory...
3232
uri.wiki=https://github.com/UnitTestBot/UTBotCpp/wiki
3333
deployment.utbot.host.description=UTBot Server host address. <a href=https://github.com/UnitTestBot/UTBotCpp/wiki/vscode-extension-settings#deployment>Learn more</a>
3434
deployment.utbot.port.description=UTBot Server port. <a href=https://github.com/UnitTestBot/UTBotCpp/wiki/vscode-extension-settings#utbot-port>Learn more</a>

clion-plugin/src/test/kotlin/org/utbot/cpp/clion/plugin/tests/buildingRequestsTests/BaseBuildingTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ open class BaseBuildingTest {
2626
Paths.get(File(".").canonicalPath).resolve("../integration-tests/c-example-mini").normalize()
2727
protected val testsDirRelativePath = "cl-plugin-test-tests"
2828
protected val testsDirectoryPath: Path = projectPath.resolve(testsDirRelativePath)
29-
protected val buildDirRelativePath = "build"
29+
protected val buildDirRelPath = "build"
3030
protected val fixture: CodeInsightTestFixture = createFixture(projectPath)
3131
protected val project: Project
3232
get() = fixture.project
3333
val settings = project.settings.storedSettings
3434

3535
init {
36-
settings.buildDirRelativePath = buildDirRelativePath
36+
settings.buildDirRelPath = buildDirRelPath
3737
settings.testDirRelativePath = projectPath.relativize(testsDirectoryPath).toString()
3838
settings.isPluginEnabled = true
3939
project.logger.logWriters.let {
@@ -56,7 +56,7 @@ open class BaseBuildingTest {
5656
projectName = project.name
5757
testDirPath =
5858
if (isRemote) "$remotePath/$testsDirRelativePath" else this@BaseBuildingTest.testsDirectoryPath.toString()
59-
buildDirRelativePath = this@BaseBuildingTest.buildDirRelativePath
59+
buildDirRelPath = this@BaseBuildingTest.buildDirRelPath
6060
}.build()
6161
}
6262

@@ -89,4 +89,4 @@ open class BaseBuildingTest {
8989

9090
return event
9191
}
92-
}
92+
}

0 commit comments

Comments
 (0)