58 lines
2.3 KiB
C++
58 lines
2.3 KiB
C++
#include <Void/Build.hpp>
|
|
#include <Void/Build/Package/Solver.hpp>
|
|
#include <Void/Build/Package/Toml.hpp>
|
|
#include <Void/Build/Util/Sha256.hpp>
|
|
#include <Void/Configuration/Argparse.hpp>
|
|
#include <Void/Text/Semver.hpp>
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
int main() {
|
|
// 1. SDK graph evaluation & deterministic UTF-8 JSON.
|
|
auto ctx = Void::Build::default_profiles().resolve("debug", Void::Build::CompilerFamily::Gcc,
|
|
"Linux", "x86_64");
|
|
Void::Build::Project p{ctx};
|
|
p.executable("smoke_app").sources({"src/main.cpp"});
|
|
if (p.to_json().find("\"smoke_app\"") == std::string::npos) {
|
|
std::cerr << "SelfBuildSmoke: SDK JSON serialization failed\n";
|
|
return 1;
|
|
}
|
|
|
|
// 2. Void::Crypto built-in FIPS 180-4 SHA-256 (VL-007).
|
|
if (Void::Build::Util::sha256_hex("abc") !=
|
|
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad") {
|
|
std::cerr << "SelfBuildSmoke: Void::Crypto SHA-256 mismatch\n";
|
|
return 1;
|
|
}
|
|
|
|
// 3. Void::Data::Toml 1.0 parser (VL-002).
|
|
auto toml = Void::Build::Package::parse_toml("[dependencies.demo]\nversion = \"^1.0\"\n");
|
|
if (!toml || !toml->contains("dependencies")) {
|
|
std::cerr << "SelfBuildSmoke: Void::Data::Toml parse failed\n";
|
|
return 1;
|
|
}
|
|
|
|
// 4. Void::Semver shorthand range parser (VL-013).
|
|
auto range = Void::Semver::parse_range("^1.0");
|
|
auto v12 = Void::Semver::parse_strict("1.2.3");
|
|
auto v20 = Void::Semver::parse_strict("2.0.0");
|
|
if (!range || !v12 || !v20 || !range->contains(*v12) || range->contains(*v20)) {
|
|
std::cerr << "SelfBuildSmoke: Void::Semver shorthand range failed\n";
|
|
return 1;
|
|
}
|
|
|
|
// 5. Void::Argparse::Parser native subcommands & auto-generated help (VL-011).
|
|
Void::Argparse::Parser parser{"smoke", "Self-build smoke CLI."};
|
|
parser.subcommand("run", "Run smoke command");
|
|
const char *argv_help[] = {"smoke", "--help"};
|
|
const auto help_res = parser.parse_detailed(2, argv_help);
|
|
if (!help_res.is_help() || help_res.message.find("Commands:") == std::string::npos) {
|
|
std::cerr << "SelfBuildSmoke: Void::Argparse generated help failed\n";
|
|
return 1;
|
|
}
|
|
|
|
std::cout << "SelfBuildSmoke: all 5 VoidBuildSystem + VoidLibrary runtime checks passed\n";
|
|
return 0;
|
|
}
|