-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathSynchronizer.h
70 lines (46 loc) · 2.4 KB
/
Synchronizer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef UNITTESTBOT_SYNCHRONIZER_H
#define UNITTESTBOT_SYNCHRONIZER_H
#include "ProjectContext.h"
#include "stubs/StubGen.h"
#include "types/Types.h"
class StubOperator {
public:
StubOperator(fs::path sourceFilePath, bool isHeader);
explicit StubOperator(fs::path stubFilePath);
bool operator ==(const StubOperator &other) const;
[[nodiscard]] fs::path getStubPath(const utbot::ProjectContext &projectContext) const;
[[nodiscard]] fs::path getSourceFilePath() const;
[[nodiscard]] bool isHeader() const;
private:
fs::path sourceFilePath;
bool header;
};
class Synchronizer {
BaseTestGen *const testGen;
types::TypesHandler::SizeContext *sizeContext;
[[nodiscard]] CollectionUtils::FileSet getOutdatedSourcePaths() const;
[[nodiscard]] std::unordered_set<StubOperator, HashUtils::StubHash> getOutdatedStubs() const;
[[nodiscard]] long long getFileOutdatedTime(const fs::path &filePath) const;
[[nodiscard]] bool isProbablyOutdatedStubs(const fs::path &srcFilePath) const;
[[nodiscard]] bool isProbablyOutdatedWrappers(const fs::path &srcFilePath) const;
bool removeStubIfSourceAbsent(const StubOperator &stub) const;
void synchronizeStubs(std::unordered_set<StubOperator, HashUtils::StubHash> &outdatedStubs,
const types::TypesHandler &typesHandler);
void synchronizeWrappers(const CollectionUtils::FileSet &outdatedSourcePaths,
const types::TypesHandler &typesHandler) const;
std::shared_ptr<CompilationDatabase>
createStubsCompilationDatabase(
std::unordered_set<StubOperator, HashUtils::StubHash> &stubFiles,
const fs::path &ccJsonStubDirPath) const;
void prepareDirectory(fs::path const &stubDirectory);
static std::unordered_set<StubOperator, HashUtils::StubHash>
getStubSetFromSources(const CollectionUtils::FileSet &paths);
[[nodiscard]] std::unordered_set<StubOperator, HashUtils::StubHash> getStubsFiles() const;
public:
static std::unordered_set<StubOperator, HashUtils::StubHash>
dropHeaders(const std::unordered_set<StubOperator, HashUtils::StubHash> &stubs);
static CollectionUtils::FileSet dropHeaders(const CollectionUtils::FileSet &files);
Synchronizer(BaseTestGen *testGen, types::TypesHandler::SizeContext *sizeContext);
void synchronize(const types::TypesHandler &typesHandler);
};
#endif // UNITTESTBOT_SYNCHRONIZER_H