blob: 262e56d9f72743eb9bec12b4fe735c06ab6ccdd4 (
plain)
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
|
// Copyright (c) 2026 Progmasoft.
// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0
#pragma once
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>
#include "tools/Repository.hpp"
namespace Progmasoft::Catch3::Tools
{
/// The single-file distribution in extras/.
struct Amalgamation final
{
std::string Header;
std::string Source;
std::string ThirdParty;
};
/// A file `#include` names at the start of a line.
struct IncludedFile final
{
std::string Name;
bool Angled = false;
};
/// Reads `#include <name>` or `#include "name"`, written exactly so.
[[nodiscard]] std::optional<IncludedFile>
ParseInclude(std::string_view line);
/// "3.16.1", or "3.17.0-preview.1", from the source of EngineVersion.cpp.
[[nodiscard]] std::optional<std::string>
ParseEngineVersion(std::string_view source);
/// Builds the distribution from the sources; deterministic, so that it
/// can be compared with what is in extras/.
[[nodiscard]] Amalgamation
GenerateAmalgamation(const std::filesystem::path &root, Problems &problems);
/// Adds a line to `problems` for each file of extras/ that `expected`
/// does not match.
void
CheckAmalgamation(const std::filesystem::path &root,
const Amalgamation &expected,
Problems &problems);
/// Writes `amalgamation` to extras/.
void
WriteAmalgamation(const std::filesystem::path &root,
const Amalgamation &amalgamation,
Problems &problems);
} // namespace Progmasoft::Catch3::Tools
|