@@ -19,7 +19,6 @@ namespace Paths {
1919 }
2020
2121 fs::path logPath = getHomeDir();
22- fs::path tmpPath = getHomeDir();
2322
2423 CollectionUtils::FileSet
2524 filterPathsByDirNames (const CollectionUtils::FileSet &paths,
@@ -190,19 +189,24 @@ namespace Paths {
190189 return getArtifactsRootDir (projectContext) / " tests" ;
191190 }
192191 fs::path getMakefileDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
193- return getArtifactsRootDir (projectContext) / " make " / getRelativeDirPath (projectContext, sourceFilePath);
192+ return getPathDirRelativeToTestDir (projectContext, sourceFilePath);
194193 }
195194 fs::path getGeneratedHeaderDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
195+ return getPathDirRelativeToTestDir (projectContext, sourceFilePath);
196+ }
197+
198+ fs::path getPathDirRelativeToTestDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
196199 return projectContext.testDirPath / getRelativeDirPath (projectContext, sourceFilePath);
197200 }
201+
198202 fs::path getRecompiledDir (const utbot::ProjectContext &projectContext) {
199- return getTmpDir (projectContext. projectName ) / " recompiled" ;
203+ return getUtbotBuildDir (projectContext) / " recompiled" ;
200204 }
201205 fs::path getTestObjectDir (const utbot::ProjectContext &projectContext) {
202- return getTmpDir (projectContext. projectName ) / " test_objects" ;
206+ return getUtbotBuildDir (projectContext) / " test_objects" ;
203207 }
204208 fs::path getCoverageDir (const utbot::ProjectContext &projectContext) {
205- return getTmpDir (projectContext. projectName ) / " coverage" ;
209+ return getUtbotBuildDir (projectContext) / " coverage" ;
206210 }
207211 fs::path getClangCoverageDir (const utbot::ProjectContext &projectContext) {
208212 return getCoverageDir (projectContext) / " lcov" ;
@@ -245,22 +249,22 @@ namespace Paths {
245249
246250 fs::path getBuildFilePath (const utbot::ProjectContext &projectContext,
247251 const fs::path &sourceFilePath) {
248- fs::path path = getTmpDir (projectContext. projectName ) /
252+ fs::path path = getUtbotBuildDir (projectContext) /
249253 getRelativeDirPath (projectContext, sourceFilePath) /
250254 sourceFilePath.filename ();
251255 return addExtension (path, " .o" );
252256 }
253257
254258 fs::path getStubBuildFilePath (const utbot::ProjectContext &projectContext,
255259 const fs::path &sourceFilePath) {
256- fs::path path = getTmpDir (projectContext. projectName ) /
260+ fs::path path = getUtbotBuildDir (projectContext) /
257261 getRelativeDirPath (projectContext, sourceFilePath) /
258262 sourcePathToStubName (sourceFilePath);
259263 return addExtension (path, " .o" );
260264 }
261265
262266 fs::path getWrapperDirPath (const utbot::ProjectContext &projectContext) {
263- return getArtifactsRootDir ( projectContext) / " wrapper" ;
267+ return projectContext. testDirPath / " wrapper" ;
264268 }
265269
266270 fs::path getWrapperFilePath (const utbot::ProjectContext &projectContext,
@@ -274,11 +278,12 @@ namespace Paths {
274278 // endregion
275279
276280 // region transformation
277- static const std::string MAKEFILE_EXTENSION = " .mk" ;
278- static const std::string TEST_SUFFIX = " _test" ;
279- static const std::string STUB_SUFFIX = " _stub" ;
280- static const std::string DOT_SEP = " _dot_" ;
281- static const char dot = ' .' ;
281+ const std::string MAKEFILE_EXTENSION = " .mk" ;
282+ const std::string TEST_SUFFIX = " _test" ;
283+ const std::string STUB_SUFFIX = " _stub" ;
284+ const std::string DOT_SEP = " _dot_" ;
285+ const std::string MAKE_WRAPPER_SUFFIX = " _wrapper" ;
286+ const char dot = ' .' ;
282287
283288 fs::path sourcePathToTestPath (const utbot::ProjectContext &projectContext,
284289 const fs::path &sourceFilePath) {
@@ -388,6 +393,18 @@ namespace Paths {
388393 return fs::relative (source.parent_path (), projectContext.projectPath );
389394 }
390395
396+ std::optional<std::string> getRelativePathWithShellVariable (const fs::path &shellVariableForBase,
397+ const std::string &base,
398+ const std::string &source) {
399+ std::string returnPath = source;
400+ if (StringUtils::startsWith (source, base)) {
401+ StringUtils::replaceFirst (returnPath, base, shellVariableForBase.string ());
402+ return returnPath;
403+ }
404+ return std::nullopt ;
405+ }
406+
407+
391408 fs::path stubPathToSourcePath (const utbot::ProjectContext &projectContext,
392409 const fs::path &stubPath) {
393410 fs::path sourceFilePath =
@@ -399,8 +416,8 @@ namespace Paths {
399416 bool isHeadersEqual (const fs::path &srcPath, const fs::path &headerPath) {
400417 return removeSuffix (srcPath, STUB_SUFFIX).stem () == headerPath.stem ();
401418 }
402- fs::path getBuildDir (const utbot::ProjectContext &projectContext) {
403- return getTmpDir ( projectContext.projectName ) / " build " ;
419+ fs::path getUtbotBuildDir (const utbot::ProjectContext &projectContext) {
420+ return projectContext.buildDir / CompilationUtils::UTBOT_BUILD_DIR_NAME ;
404421 }
405422
406423 // endregion
0 commit comments