@@ -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,
@@ -193,19 +192,24 @@ namespace Paths {
193192 return getArtifactsRootDir (projectContext) / " tests" ;
194193 }
195194 fs::path getMakefileDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
196- return getArtifactsRootDir (projectContext) / " make " / getRelativeDirPath (projectContext, sourceFilePath);
195+ return getPathDirRelativeToTestDir (projectContext, sourceFilePath);
197196 }
198197 fs::path getGeneratedHeaderDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
198+ return getPathDirRelativeToTestDir (projectContext, sourceFilePath);
199+ }
200+
201+ fs::path getPathDirRelativeToTestDir (const utbot::ProjectContext &projectContext, const fs::path &sourceFilePath) {
199202 return projectContext.testDirPath / getRelativeDirPath (projectContext, sourceFilePath);
200203 }
204+
201205 fs::path getRecompiledDir (const utbot::ProjectContext &projectContext) {
202- return getTmpDir (projectContext. projectName ) / " recompiled" ;
206+ return getUtbotBuildDir (projectContext) / " recompiled" ;
203207 }
204208 fs::path getTestObjectDir (const utbot::ProjectContext &projectContext) {
205- return getTmpDir (projectContext. projectName ) / " test_objects" ;
209+ return getUtbotBuildDir (projectContext) / " test_objects" ;
206210 }
207211 fs::path getCoverageDir (const utbot::ProjectContext &projectContext) {
208- return getTmpDir (projectContext. projectName ) / " coverage" ;
212+ return getUtbotBuildDir (projectContext) / " coverage" ;
209213 }
210214 fs::path getClangCoverageDir (const utbot::ProjectContext &projectContext) {
211215 return getCoverageDir (projectContext) / " lcov" ;
@@ -248,22 +252,22 @@ namespace Paths {
248252
249253 fs::path getBuildFilePath (const utbot::ProjectContext &projectContext,
250254 const fs::path &sourceFilePath) {
251- fs::path path = getTmpDir (projectContext. projectName ) /
255+ fs::path path = getUtbotBuildDir (projectContext) /
252256 getRelativeDirPath (projectContext, sourceFilePath) /
253257 sourceFilePath.filename ();
254258 return addExtension (path, " .o" );
255259 }
256260
257261 fs::path getStubBuildFilePath (const utbot::ProjectContext &projectContext,
258262 const fs::path &sourceFilePath) {
259- fs::path path = getTmpDir (projectContext. projectName ) /
263+ fs::path path = getUtbotBuildDir (projectContext) /
260264 getRelativeDirPath (projectContext, sourceFilePath) /
261265 sourcePathToStubName (sourceFilePath);
262266 return addExtension (path, " .o" );
263267 }
264268
265269 fs::path getWrapperDirPath (const utbot::ProjectContext &projectContext) {
266- return getArtifactsRootDir ( projectContext) / " wrapper" ;
270+ return projectContext. testDirPath / " wrapper" ;
267271 }
268272
269273 fs::path getWrapperFilePath (const utbot::ProjectContext &projectContext,
@@ -277,11 +281,12 @@ namespace Paths {
277281 // endregion
278282
279283 // region transformation
280- static const std::string MAKEFILE_EXTENSION = " .mk" ;
281- static const std::string TEST_SUFFIX = " _test" ;
282- static const std::string STUB_SUFFIX = " _stub" ;
283- static const std::string DOT_SEP = " _dot_" ;
284- static const char dot = ' .' ;
284+ const std::string MAKEFILE_EXTENSION = " .mk" ;
285+ const std::string TEST_SUFFIX = " _test" ;
286+ const std::string STUB_SUFFIX = " _stub" ;
287+ const std::string DOT_SEP = " _dot_" ;
288+ const std::string MAKE_WRAPPER_SUFFIX = " _wrapper" ;
289+ const char dot = ' .' ;
285290
286291 fs::path sourcePathToTestPath (const utbot::ProjectContext &projectContext,
287292 const fs::path &sourceFilePath) {
@@ -391,6 +396,18 @@ namespace Paths {
391396 return fs::relative (source.parent_path (), projectContext.projectPath );
392397 }
393398
399+ std::optional<std::string> getRelativePathWithShellVariable (const fs::path &shellVariableForBase,
400+ const std::string &base,
401+ const std::string &source) {
402+ std::string returnPath = source;
403+ if (StringUtils::startsWith (source, base)) {
404+ StringUtils::replaceFirst (returnPath, base, shellVariableForBase.string ());
405+ return returnPath;
406+ }
407+ return std::nullopt ;
408+ }
409+
410+
394411 fs::path stubPathToSourcePath (const utbot::ProjectContext &projectContext,
395412 const fs::path &stubPath) {
396413 fs::path sourceFilePath =
@@ -402,8 +419,8 @@ namespace Paths {
402419 bool isHeadersEqual (const fs::path &srcPath, const fs::path &headerPath) {
403420 return removeSuffix (srcPath, STUB_SUFFIX).stem () == headerPath.stem ();
404421 }
405- fs::path getBuildDir (const utbot::ProjectContext &projectContext) {
406- return getTmpDir ( projectContext.projectName ) / " build " ;
422+ fs::path getUtbotBuildDir (const utbot::ProjectContext &projectContext) {
423+ return projectContext.buildDir / CompilationUtils::UTBOT_BUILD_DIR_NAME ;
407424 }
408425
409426 // endregion
0 commit comments