-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBuildContextCompatTests.cpp
More file actions
66 lines (56 loc) · 1.92 KB
/
Copy pathBuildContextCompatTests.cpp
File metadata and controls
66 lines (56 loc) · 1.92 KB
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
/**
*
* @file BuildContextCompatTests.cpp
* @author Gaspard Kirira
*
* Copyright 2026, Gaspard Kirira. All rights reserved.
* https://github.com/vixcpp/vix
* Use of this source code is governed by a MIT license
* that can be found in the License file.
*
* Vix.cpp
*
* CLI build context compatibility tests
*
*/
#include <vix/cli/build/BuildContext.hpp>
#include <cassert>
#include <filesystem>
#include <type_traits>
int main()
{
namespace build = vix::cli::build;
namespace process = vix::cli::process;
namespace engine = vix::engine;
static_assert(std::is_same_v<process::Preset, engine::Preset>);
static_assert(std::is_same_v<process::Plan, engine::ExecutionPlan>);
const auto preset = build::resolve_builtin_preset("dev-ninja");
assert(preset.has_value());
assert(preset->name == "dev-ninja");
assert(preset->generator == "Ninja");
assert(preset->buildType == "Debug");
assert(preset->buildDirName == "build-ninja");
assert(!build::resolve_builtin_preset("unknown").has_value());
process::Options options;
process::Plan plan;
plan.userProjectDir = "/tmp/app";
plan.cmakeSourceDir = "/tmp/app";
plan.projectDir = "/tmp/app";
plan.preset = *preset;
plan.buildDir = "/tmp/app/build-ninja";
options.buildTarget = "explicit";
assert(build::default_build_target_name(options, plan) == "explicit");
assert(build::default_graph_target_name(options, plan) == "explicit");
options.buildTarget.clear();
plan.defaultTargetName = "manifest-name";
assert(build::default_build_target_name(options, plan) == "manifest-name");
plan.defaultTargetName.clear();
assert(build::default_build_target_name(options, plan) == "app");
#ifdef _WIN32
const std::filesystem::path expectedExe = "/tmp/app/build-ninja/app.exe";
#else
const std::filesystem::path expectedExe = "/tmp/app/build-ninja/app";
#endif
assert(build::default_project_executable_path(options, plan) == expectedExe);
return 0;
}