Skip to content

Commit

Permalink
Name refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ladisgin committed Mar 29, 2024
1 parent d81bf92 commit 84a35fe
Show file tree
Hide file tree
Showing 53 changed files with 436 additions and 394 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GrpcRequestBuilderFactory(
project.name,
project.path,
project.settings.storedSettings.testDirRelativePath,
project.settings.storedSettings.buildDirRelativePath
project.settings.storedSettings.buildDirRelPath
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal data class ProjectContextBuilder(
val projectName: String,
val projectPath: String,
val testDirRelativePath: String,
val buildDirRelativePath: String
val buildDirRelPath: String
) : GrpcRequestBuilder<Testgen.ProjectContext> {
override fun build(remoteMapping: RemoteMapping): Testgen.ProjectContext {
val projectNioPath = Paths.get(projectPath) // project path is not set by user, assuming it is valid
Expand All @@ -29,7 +29,7 @@ internal data class ProjectContextBuilder(
UTBot.message("settings.project.testsDir.wrong")
)
)
.setBuildDirRelativePath(buildDirRelativePath)
.setBuildDirRelPath(buildDirRelPath)
.setProjectName(projectName)
.setProjectPath(remoteMapping.convertToRemote(projectPath, UTBot.message("projectPath.wrong.conversion")))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class UTBotAllProjectSettings(val project: Project) {
val buildDirPath: Path
get() {
try {
return Paths.get(project.path).resolve(storedSettings.buildDirRelativePath)
return Paths.get(project.path).resolve(storedSettings.buildDirRelPath)
} catch (e: InvalidPathException) {
throw IllegalPathException(
UTBot.message(
"paths.invalid",
"relative path to build dir",
storedSettings.buildDirRelativePath
storedSettings.buildDirRelPath
),
storedSettings.buildDirRelativePath
storedSettings.buildDirRelPath
)
}
}
Expand Down Expand Up @@ -82,7 +82,7 @@ class UTBotAllProjectSettings(val project: Project) {

fun predictPaths() {
storedSettings.remotePath = UTBotProjectStoredSettings.REMOTE_PATH_VALUE_FOR_LOCAL_SCENARIO
storedSettings.buildDirRelativePath = UTBotProjectStoredSettings.DEFAULT_RELATIVE_PATH_TO_BUILD_DIR
storedSettings.buildDirRelPath = UTBotProjectStoredSettings.DEFAULT_RELATIVE_PATH_TO_BUILD_DIR
storedSettings.targetPath = UTBotTarget.autoTarget.path
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(

private fun Panel.createPathsSettings() {
row(UTBot.message("settings.project.buildDir")) {
textField().bindText(settings::buildDirRelativePath).columns(COLUMNS_LARGE)
textField().bindText(settings::buildDirRelPath).columns(COLUMNS_LARGE)
.validateInput(ValidationCondition(UTBot.message("validation.not.empty")) {
it.text.stripLeadingSlashes().isNotEmpty()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UTBotProjectStoredSettings(val project: Project) : PersistentStateComponen

// serialized by the ide
data class State(
var buildDirRelativePath: String = DEFAULT_RELATIVE_PATH_TO_BUILD_DIR,
var buildDirRelPath: String = DEFAULT_RELATIVE_PATH_TO_BUILD_DIR,
var testsDirRelativePath: String = DEFAULT_TESTS_DIR_RELATIVE_PATH,
var targetPath: String = UTBotTarget.autoTarget.path,
var remotePath: String = REMOTE_PATH_VALUE_FOR_LOCAL_SCENARIO,
Expand All @@ -44,7 +44,7 @@ class UTBotProjectStoredSettings(val project: Project) : PersistentStateComponen
var isPluginEnabled: Boolean = false
) {
fun fromSettingsModel(model: UTBotSettingsModel) {
buildDirRelativePath = model.projectSettings.buildDirRelativePath
buildDirRelPath = model.projectSettings.buildDirRelPath
testsDirRelativePath = model.projectSettings.testsDirRelativePath
targetPath = model.projectSettings.targetPath
remotePath = model.projectSettings.remotePath
Expand Down Expand Up @@ -129,10 +129,10 @@ class UTBotProjectStoredSettings(val project: Project) : PersistentStateComponen
else
Paths.get(project.path).relativize(Paths.get(targetPath)).toString()

var buildDirRelativePath: String
get() = myState.buildDirRelativePath.stripLeadingSlashes()
var buildDirRelPath: String
get() = myState.buildDirRelPath.stripLeadingSlashes()
set(value) {
myState.buildDirRelativePath = value
myState.buildDirRelPath = value
}

var isPluginEnabled: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BuildOptionsStep(parentDisposable: Disposable, private val settingsModel:
addHtml("media/options_wizard_text.html")
panel {
row("Relative path to Build directory") {
textField().bindText(settingsModel.projectSettings::buildDirRelativePath).columns(COLUMNS_LARGE)
textField().bindText(settingsModel.projectSettings::buildDirRelPath).columns(COLUMNS_LARGE)
.validateWith(ValidationCondition(UTBot.message("validation.not.empty")) { it.text.isNotEmpty() })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ open class BaseBuildingTest {
Paths.get(File(".").canonicalPath).resolve("../integration-tests/c-example-mini").normalize()
protected val testsDirRelativePath = "cl-plugin-test-tests"
protected val testsDirectoryPath: Path = projectPath.resolve(testsDirRelativePath)
protected val buildDirRelativePath = "build"
protected val buildDirRelPath = "build"
protected val fixture: CodeInsightTestFixture = createFixture(projectPath)
protected val project: Project
get() = fixture.project
val settings = project.settings.storedSettings

init {
settings.buildDirRelativePath = buildDirRelativePath
settings.buildDirRelPath = buildDirRelPath
settings.testDirRelativePath = projectPath.relativize(testsDirectoryPath).toString()
settings.isPluginEnabled = true
project.logger.logWriters.let {
Expand All @@ -56,7 +56,7 @@ open class BaseBuildingTest {
projectName = project.name
testDirPath =
if (isRemote) "$remotePath/$testsDirRelativePath" else this@BaseBuildingTest.testsDirectoryPath.toString()
buildDirRelativePath = this@BaseBuildingTest.buildDirRelativePath
buildDirRelPath = this@BaseBuildingTest.buildDirRelPath
}.build()
}

Expand Down Expand Up @@ -89,4 +89,4 @@ open class BaseBuildingTest {

return event
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract class BaseGenerationTestCase {
get() = project.client

init {
project.settings.storedSettings.buildDirRelativePath = buildDirName
project.settings.storedSettings.buildDirRelPath = buildDirName
project.settings.storedSettings.testDirRelativePath = projectPath.relativize(testsDirectoryPath).toString()
project.settings.storedSettings.isPluginEnabled = true
project.logger.logWriters.let {
Expand Down Expand Up @@ -102,4 +102,4 @@ abstract class BaseGenerationTestCase {
fixture.tearDown()
Logger.info("tearDownAll of BaseGenerationTest has finished!")
}
}
}
9 changes: 5 additions & 4 deletions server/proto/testgen.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ message LogEntry {
message ProjectContext {
string projectName = 1;
string projectPath = 2;
string testDirPath = 3;
string buildDirRelativePath = 4;
string clientProjectPath = 5;
string itfPath = 6;
string clientProjectPath = 3;
string testDirRelPath = 4;
string reportDirRelPath = 5;
string buildDirRelPath = 6;
string itfRelPath = 7;
}

enum ErrorMode {
Expand Down
2 changes: 1 addition & 1 deletion server/src/KleeRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void KleeRunner::runKlee(const std::vector<tests::TestMethod> &testMethods,
testsWriter->writeTestsWithProgress(
testsMap,
"Running klee",
projectContext.testDirPath,
projectContext.getTestDirAbsPath(),
std::move(prepareTests),
std::move(prepareTotal));
}
Expand Down
Loading

0 comments on commit 84a35fe

Please sign in to comment.