diff --git a/include/vix/cli/commands/run/RunDetail.hpp b/include/vix/cli/commands/run/RunDetail.hpp index 5651748..72cdb9b 100644 --- a/include/vix/cli/commands/run/RunDetail.hpp +++ b/include/vix/cli/commands/run/RunDetail.hpp @@ -93,67 +93,50 @@ namespace vix::commands::RunCommand::detail */ struct Options { - // ------------------------------------------------------------------------- - // Input selection - // ------------------------------------------------------------------------- + std::vector scriptFlags; + std::vector cmakeArgs; + std::vector compilerArgs; + std::vector linkerArgs; + std::vector runArgs; + std::vector runEnv; + + // Input and project selection std::string appName; std::string exampleName; - - bool singleCpp = false; - fs::path cppFile; - - - // Project/build selection std::string preset = "dev-ninja"; std::string runPreset; std::string dir; + std::string logLevel; + std::string logFormat; + std::string logColor; // auto|always|never + std::string clearMode = "auto"; + std::string compilerFingerprint = "fast"; + std::string cwd; + fs::path cppFile; + int jobs = 0; + AutoDepsMode autoDeps = AutoDepsMode::None; + DiagnosticMode diagnosticMode{DiagnosticMode::None}; + int timeoutSec = 0; + int parseExitCode = 0; + ::vix::cli::commands::DiagnosticRequest diagnosticRequest{}; + ::vix::cli::commands::DiagnosticRequest projectDiagnosticRequest{}; + + bool singleCpp = false; bool clean = false; bool checkOnly = false; - - // Output / UI bool quiet = false; bool verbose = false; - std::string logLevel; - std::string logFormat; - std::string logColor; // auto|always|never bool noColor = false; - std::string clearMode = "auto"; bool ui = false; bool envHint = false; bool traceCache = false; - std::string compilerFingerprint = "fast"; - - // Behavior switches bool watch = false; - AutoDepsMode autoDeps = AutoDepsMode::None; - bool forceServerLike = false; bool forceScriptLike = false; - - DiagnosticMode diagnosticMode{DiagnosticMode::None}; - ::vix::cli::commands::DiagnosticRequest diagnosticRequest{}; - ::vix::cli::commands::DiagnosticRequest projectDiagnosticRequest{}; - - std::optional docs; - - // Script / runtime forwarding - std::vector scriptFlags; - std::vector cmakeArgs; - std::vector compilerArgs; - std::vector linkerArgs; - std::vector runArgs; - std::vector runEnv; - - int timeoutSec = 0; - std::string cwd; - - // Parse diagnostics / separators bool parseFailed = false; - int parseExitCode = 0; - bool localCache = false; - + std::optional docs; }; /** diff --git a/include/vix/cli/distribution/Distribution.hpp b/include/vix/cli/distribution/Distribution.hpp index e423bb1..b3845e8 100644 --- a/include/vix/cli/distribution/Distribution.hpp +++ b/include/vix/cli/distribution/Distribution.hpp @@ -117,7 +117,7 @@ namespace vix::cli::distribution ArchiveFormat archive{ArchiveFormat::tar_gz}; DistributionArtifactDigest digest; std::optional size; - std::optional installPath; + std::optional installPath{}; }; struct ReleaseManifest diff --git a/include/vix/cli/process/Process.hpp b/include/vix/cli/process/Process.hpp index a35c886..ccdb3af 100644 --- a/include/vix/cli/process/Process.hpp +++ b/include/vix/cli/process/Process.hpp @@ -40,6 +40,12 @@ namespace vix::cli::process */ struct Options { + std::size_t warningsPage{1}; + std::size_t warningsLimit{10}; + std::vector cmakeArgs; + std::vector compilerArgs; + std::vector linkerArgs; + /** * @brief Selected embedded preset. * @@ -49,163 +55,49 @@ namespace vix::cli::process * - release */ std::string preset = "dev-ninja"; - - /** - * @brief Cross-compilation target triple passed with `--target`. - */ std::string targetTriple; - - /** - * @brief Optional sysroot path for cross-compilation. - */ std::string sysroot; + std::string debugLogScope; + std::string logScope; + std::string logPath; + std::string dir; + std::string graphExecutor = "auto"; + std::string buildTarget; + std::string outPath; + fs::path cppFile; /** - * @brief Enables static linking when supported by the project. - */ - bool linkStatic = false; - - /** - * @brief Number of parallel jobs to use for the build. - * - * A value of 0 means "auto-detect". + * @brief Number of parallel jobs to use; zero means auto-detect. */ int jobs = 0; + LinkerMode linker = LinkerMode::Auto; + LauncherMode launcher = LauncherMode::Auto; + SanitizerMode sanitizerMode = SanitizerMode::None; - /** - * @brief Forces a fresh configure step. - */ + bool linkStatic = false; bool clean = false; - - /** - * @brief Enables quiet console output. - */ bool quiet = false; - - /** - * @brief Enables detailed build output. - * - * When false, `vix build` should prefer a minimal product-style output. - */ bool verbose = false; - - /** Enables structured internal Vix build diagnostics. */ bool debug = false; - - /** Optional focused internal diagnostic scope. */ - std::string debugLogScope; - - /** Optional captured log scope to display instead of building. */ - std::string logScope; bool showLog = false; - std::string logPath; - - /** - * @brief Explains why Vix rebuilds files or targets. - */ bool explain = false; - - /** - * @brief Keep the build process alive and rebuild after project changes. - */ bool watch = false; - - /** - * @brief Optional project directory passed with `--dir`. - */ - std::string dir; - - /** - * @brief Enables fast no-op detection before building. - */ bool fast = false; - - /** - * @brief Enables signature/configuration cache reuse. - */ bool useCache = true; - - /** - * @brief Preferred linker mode. - */ - LinkerMode linker = LinkerMode::Auto; - - /** - * @brief Preferred compiler launcher mode. - */ - LauncherMode launcher = LauncherMode::Auto; - - /** - * @brief Enables Ninja progress status output. - */ bool status = true; - - /** - * @brief Enables Ninja dry-run up-to-date detection. - */ bool dryUpToDate = true; - - /** - * @brief Enables raw CMake verbose configure output. - */ bool cmakeVerbose = false; - - /** Graph executor policy: auto, on, or off. */ - std::string graphExecutor = "auto"; bool graphExecutorExplicit = false; - - /** Lists detected target toolchains and exits. */ bool listTargets = false; - - /** Explicit heartbeat control; unset keeps the legacy/default behavior. */ - std::optional heartbeat; - - /** - * @brief Builds only a specific CMake target when provided. - */ - std::string buildTarget; - - /** Internal caller request: ensure a CMake File API snapshot is available. */ bool requireProjectMetadata{false}; - - /** - * @brief Extra arguments forwarded directly to CMake. - */ - std::vector cmakeArgs; - - /** Exact compiler arguments for standalone single-source builds. */ - std::vector compilerArgs; - - /** Exact linker arguments for standalone single-source builds. */ - std::vector linkerArgs; - - /** - * @brief Sanitizer instrumentation selected for this build. - * - * The default build remains uninstrumented. - */ - SanitizerMode sanitizerMode = SanitizerMode::None; - - /** - * @brief True when the sanitizer mode was explicitly selected. - */ bool sanitizerSelectionExplicit = false; - - bool exportBin = false; - std::string outPath; - bool singleCpp = false; - fs::path cppFile; - bool warnings{false}; - std::size_t warningsPage{1}; - std::size_t warningsLimit{10}; bool warningsPageSet{false}; bool warningsLimitSet{false}; - bool warningCheck{false}; - + std::optional heartbeat; }; /** diff --git a/include/vix/cli/project/native/NativeDevelopmentRuntime.hpp b/include/vix/cli/project/native/NativeDevelopmentRuntime.hpp index 42ae5a4..78eff7a 100644 --- a/include/vix/cli/project/native/NativeDevelopmentRuntime.hpp +++ b/include/vix/cli/project/native/NativeDevelopmentRuntime.hpp @@ -43,11 +43,11 @@ namespace vix::cli::project::native struct NativeDevelopmentResult { int exitCode{1}; - std::string diagnostic; - std::string output; + std::string diagnostic{}; + std::string output{}; NativeDevelopmentErrorCode code{NativeDevelopmentErrorCode::project_error}; - std::optional projectError; - std::optional artifactPath; + std::optional projectError{}; + std::optional artifactPath{}; [[nodiscard]] bool success() const noexcept { return exitCode == 0; } }; diff --git a/include/vix/cli/project/native/RegistryDirectory.hpp b/include/vix/cli/project/native/RegistryDirectory.hpp index be3e041..b17bc47 100644 --- a/include/vix/cli/project/native/RegistryDirectory.hpp +++ b/include/vix/cli/project/native/RegistryDirectory.hpp @@ -36,7 +36,7 @@ namespace vix::cli::project::native std::vector locations; // Independent content mirrors; declaration order is fallback preference. // Empty is valid when this Registry serves metadata but no content mirrors. - std::vector contentLocations; + std::vector contentLocations{}; }; enum class RegistryDirectoryErrorCode diff --git a/src/commands/run/RunProcess.cpp b/src/commands/run/RunProcess.cpp index bc27b80..4684209 100644 --- a/src/commands/run/RunProcess.cpp +++ b/src/commands/run/RunProcess.cpp @@ -1582,7 +1582,6 @@ namespace vix::commands::RunCommand::detail { finalStatus = status; haveStatus = true; - running = false; } break; } diff --git a/src/commands/run/RunScript.cpp b/src/commands/run/RunScript.cpp index 7613336..2bd312e 100644 --- a/src/commands/run/RunScript.cpp +++ b/src/commands/run/RunScript.cpp @@ -2188,8 +2188,6 @@ namespace vix::commands::RunCommand::detail pid_t r = waitpid(pid, &status, WNOHANG); if (r == pid) { - running = false; - const auto childEnd = Clock::now(); const auto ms = std::chrono::duration_cast(childEnd - childStart).count(); diff --git a/src/project/native/NativeDevelopmentRuntime.cpp b/src/project/native/NativeDevelopmentRuntime.cpp index c28c2d0..f1ac736 100644 --- a/src/project/native/NativeDevelopmentRuntime.cpp +++ b/src/project/native/NativeDevelopmentRuntime.cpp @@ -732,7 +732,6 @@ namespace vix::cli::project::native return std::nullopt; } prepared.snapshot = std::move(*configured.snapshot); - configuredSuccessfully = true; prepared.snapshot->project.root = root; prepared.snapshot->project.tests.clear(); for (std::size_t index = 0; index < prepared.project.tests.size(); ++index) diff --git a/src/project/native/PackagePublication.cpp b/src/project/native/PackagePublication.cpp index 1daa949..5740f34 100644 --- a/src/project/native/PackagePublication.cpp +++ b/src/project/native/PackagePublication.cpp @@ -202,7 +202,11 @@ namespace vix::cli::project::native entry.executable = executable_file(status); const auto bytes = read_file_bytes(it->path()); entry.content.reserve(bytes.size()); - for (const unsigned char byte : bytes) entry.content.push_back(static_cast(byte)); + for (const char character : bytes) + { + const auto byte = static_cast(character); + entry.content.push_back(static_cast(byte)); + } } else if (!fs::is_directory(status)) { diff --git a/tests/DistributionRuntimeTests.cpp b/tests/DistributionRuntimeTests.cpp index 4c0db15..dfbe202 100644 --- a/tests/DistributionRuntimeTests.cpp +++ b/tests/DistributionRuntimeTests.cpp @@ -459,10 +459,10 @@ int main() const auto exposed = root / "user-bin" / "vix"; PosixExecutableExposure exposure{exposed}; ManagedInstallerRuntime runtime{source, fetcher, packageExtractor, activator, exposure}; - const auto host = parse_host_platform("x86_64-linux-gnu"); - assert(host.valid()); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); + assert(bootstrap_host.valid()); const auto home = root / "home"; - const auto result = runtime.install(home, trust, exposed, *host.value); + const auto result = runtime.install(home, trust, exposed, *bootstrap_host.value); assert(result.valid() && result.value->version == "2.4.0"); assert(source.calls == 1 && fetcher.calls == 1 && packageExtractor.calls == 1); assert(fs::is_symlink(exposed)); @@ -489,8 +489,8 @@ int main() PosixInstallationActivator activator{root / "home"}; FakeExposure exposure; ManagedInstallerRuntime runtime{source, fetcher, packageExtractor, activator, exposure}; - const auto host = parse_host_platform("x86_64-linux-gnu"); - const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *host.value); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); + const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *bootstrap_host.value); assert(!result.valid() && result.error->code == ErrorCode::wrong_generation); assert(fetcher.calls == 0 && packageExtractor.calls == 0 && exposure.calls == 0); const auto active = activator.current_version(); @@ -511,8 +511,8 @@ int main() PosixInstallationActivator activator{root / "home"}; FakeExposure exposure; ManagedInstallerRuntime runtime{source, fetcher, packageExtractor, activator, exposure}; - const auto host = parse_host_platform("x86_64-linux-gnu"); - const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *host.value); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); + const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *bootstrap_host.value); assert(!result.valid() && result.error->code == ErrorCode::invalid_signature); assert(fetcher.calls == 0 && packageExtractor.calls == 0 && exposure.calls == 0); } @@ -531,8 +531,8 @@ int main() assert(activator.activate("2.3.0").valid()); FakeExposure exposure; ManagedInstallerRuntime runtime{source, fetcher, packageExtractor, activator, exposure}; - const auto host = parse_host_platform("x86_64-linux-gnu"); - const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *host.value); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); + const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *bootstrap_host.value); assert(!result.valid() && result.error->code == ErrorCode::already_installed); assert(source.calls == 0 && fetcher.calls == 0 && packageExtractor.calls == 0); const auto current = activator.current_version(); @@ -554,14 +554,14 @@ int main() ManagedInstallerRuntime runtime{source, fetcher, packageExtractor, activator, exposure}; const auto arm = parse_host_platform("aarch64-linux-gnu"); assert(arm.valid()); - const auto unsupported = runtime.install(root / "home", trust, root / "bin" / "vix", *arm.value); - assert(!unsupported.valid() && unsupported.error->code == ErrorCode::unsupported_host_artifact); + const auto unsupported_arch_install = runtime.install(root / "home", trust, root / "bin" / "vix", *arm.value); + assert(!unsupported_arch_install.valid() && unsupported_arch_install.error->code == ErrorCode::unsupported_host_artifact); assert(fetcher.calls == 0 && packageExtractor.calls == 0); source.value = signed_fixture(archiveBytes); fetcher.bytes = "different-archive-bytes"; - const auto host = parse_host_platform("x86_64-linux-gnu"); - const auto mismatch = runtime.install(root / "home", trust, root / "bin" / "vix", *host.value); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); + const auto mismatch = runtime.install(root / "home", trust, root / "bin" / "vix", *bootstrap_host.value); assert(!mismatch.valid() && mismatch.error->code == ErrorCode::artifact_digest_mismatch); assert(packageExtractor.calls == 0 && exposure.calls == 0); } @@ -580,8 +580,8 @@ int main() PosixInstallationActivator activator{root / "home"}; FakeExposure exposure; ManagedInstallerRuntime runtime{source, fetcher, packageExtractor, activator, exposure}; - const auto host = parse_host_platform("x86_64-linux-gnu"); - const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *host.value); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); + const auto result = runtime.install(root / "home", trust, root / "bin" / "vix", *bootstrap_host.value); assert(!result.valid() && result.error->code == ErrorCode::unsafe_archive); assert(exposure.calls == 0 && !fs::exists(root / "home" / "current")); assert(!fs::exists(root / "home" / "install.toml")); @@ -596,7 +596,7 @@ int main() const auto trust = load_release_trust_store(trustPath); assert(trust.valid()); const auto home = root / "managed"; - const auto host = parse_host_platform("x86_64-linux-gnu"); + const auto bootstrap_host = parse_host_platform("x86_64-linux-gnu"); FakeSource source; source.value = signed_fixture(archiveBytes, "current", {}, {2, 3, 0, {}}); FakeFetcher fetcher; @@ -604,13 +604,13 @@ int main() PosixInstallationActivator activator{home}; FakeExposure exposure; ManagedInstallerRuntime installer{source, fetcher, packageExtractor, activator, exposure}; - const auto installed = installer.install(home, *trust.value, root / "bin" / "vix", *host.value); + const auto installed = installer.install(home, *trust.value, root / "bin" / "vix", *bootstrap_host.value); assert(installed.valid() && installed.value->version == "2.3.0"); assert(fs::is_directory(home / "versions" / "2.3.0")); source.value = signed_fixture(archiveBytes); UpgradeRuntime upgrader{source, fetcher, packageExtractor, activator}; - const auto upgraded = upgrader.run(home / "install.toml", trustPath, *host.value); + const auto upgraded = upgrader.run(home / "install.toml", trustPath, *bootstrap_host.value); assert(upgraded.valid() && upgraded.value->kind == RuntimeOutcomeKind::upgraded && upgraded.value->version == std::optional{"2.4.0"}); const auto activeB = activator.current_version(); diff --git a/tests/NativeRegistryAuthorityTests.cpp b/tests/NativeRegistryAuthorityTests.cpp index a349998..be96784 100644 --- a/tests/NativeRegistryAuthorityTests.cpp +++ b/tests/NativeRegistryAuthorityTests.cpp @@ -95,7 +95,7 @@ namespace RegistryDirectory make_locations(std::vector descriptors) { - RegistryDefinition definition{"vix", {}}; + RegistryDefinition definition{"vix", {}, {}}; for (auto &descriptor : descriptors) definition.locations.push_back({std::move(descriptor)}); auto result = build_registry_directory({std::move(definition)}); assert(result.valid()); diff --git a/tests/NativeRegistryDirectoryTests.cpp b/tests/NativeRegistryDirectoryTests.cpp index 6ba4203..b8adc6f 100644 --- a/tests/NativeRegistryDirectoryTests.cpp +++ b/tests/NativeRegistryDirectoryTests.cpp @@ -182,26 +182,26 @@ namespace void directory_identity_and_validation_tests() { const RegistryPackageIdentity logical{"vix", "softadastra", "sqlite"}; - auto first = build_registry_directory({{"vix", {{"location-A"}, {"location-B"}}}}); - auto relocated = build_registry_directory({{"vix", {{"location-C"}}}}); + auto first = build_registry_directory({{"vix", {{"location-A"}, {"location-B"}}, {}}}); + auto relocated = build_registry_directory({{"vix", {{"location-C"}}, {}}}); assert(first.valid() && relocated.valid()); assert(first.value->find(logical.registry)->id == relocated.value->find(logical.registry)->id); assert(logical.registry == "vix" && logical.publisher == "softadastra" && logical.name == "sqlite"); - auto sharedLocation = build_registry_directory({{"vix", {{"location-X"}}}, {"company", {{"location-X"}}}}); + auto sharedLocation = build_registry_directory({{"vix", {{"location-X"}}, {}}, {"company", {{"location-X"}}, {}}}); assert(sharedLocation.valid()); assert(sharedLocation.value->find("vix") && sharedLocation.value->find("company")); assert(sharedLocation.value->find("vix")->locations.front() == sharedLocation.value->find("company")->locations.front()); assert((RegistryPackageIdentity{"vix", "example", "pkg"} != RegistryPackageIdentity{"company", "example", "pkg"})); - auto duplicateIds = build_registry_directory({{"vix", {{"A"}}}, {"vix", {{"B"}}}}); + auto duplicateIds = build_registry_directory({{"vix", {{"A"}}, {}}, {"vix", {{"B"}}, {}}}); assert(!duplicateIds.valid() && duplicateIds.issues.front().code == RegistryDirectoryErrorCode::duplicate_registry_id); - auto noLocations = build_registry_directory({{"vix", {}}}); + auto noLocations = build_registry_directory({{"vix", {}, {}}}); assert(!noLocations.valid() && noLocations.issues.front().code == RegistryDirectoryErrorCode::no_registry_locations); - auto orderOne = build_registry_directory({{"company", {{"X"}}}, {"vix", {{"A"}, {"B"}}}}); - auto orderTwo = build_registry_directory({{"vix", {{"A"}, {"B"}}}, {"company", {{"X"}}}}); + auto orderOne = build_registry_directory({{"company", {{"X"}}, {}}, {"vix", {{"A"}, {"B"}}, {}}}); + auto orderTwo = build_registry_directory({{"vix", {{"A"}, {"B"}}, {}}, {"company", {{"X"}}, {}}}); assert(orderOne.valid() && orderTwo.valid()); assert(orderOne.value->find("vix")->locations == orderTwo.value->find("vix")->locations); diff --git a/tests/NativeRegistryMetadataSourceTests.cpp b/tests/NativeRegistryMetadataSourceTests.cpp index 2306f8d..b3a4e5d 100644 --- a/tests/NativeRegistryMetadataSourceTests.cpp +++ b/tests/NativeRegistryMetadataSourceTests.cpp @@ -133,8 +133,14 @@ project-target = "core" } MemoryMetadataTransport transport() const - { MemoryMetadataTransport value; value.files.emplace(headPath, head); value.files.emplace(manifestPath, manifest); - if (!packagePath.empty()) value.files.emplace(packagePath, packageDocument); return value; } + { + MemoryMetadataTransport value; + value.files.emplace(headPath, head); + value.files.emplace(manifestPath, manifest); + if (!packagePath.empty()) + value.files.emplace(packagePath, packageDocument); + return value; + } }; void canonical_manifest_and_authority_tests() diff --git a/tests/NativeRegistrySnapshotStateTests.cpp b/tests/NativeRegistrySnapshotStateTests.cpp index 2da53a0..2433536 100644 --- a/tests/NativeRegistrySnapshotStateTests.cpp +++ b/tests/NativeRegistrySnapshotStateTests.cpp @@ -104,7 +104,7 @@ namespace RegistryDirectory locations; RegistryAuthorityDirectory authorities; Fixture() - : locations(*build_registry_directory({{"vix", {{"first"}, {"second"}}}}).value), + : locations(*build_registry_directory({{"vix", {{"first"}, {"second"}}, {}}}).value), authorities(*build_registry_authority_directory({{"vix", "authority"}}).value) {} }; @@ -221,7 +221,7 @@ namespace void independent_registry_pin_tests() { auto locationResult = build_registry_directory({ - {"vix", {{"shared-vix"}}}, {"acme", {{"shared-acme"}}}}); + {"vix", {{"shared-vix"}}, {}}, {"acme", {{"shared-acme"}}, {}}}); auto authorityResult = build_registry_authority_directory({ {"vix", "authority-vix"}, {"acme", "authority-acme"}}); assert(locationResult.valid() && authorityResult.valid()); diff --git a/tests/NativeResolverTests.cpp b/tests/NativeResolverTests.cpp index b2738f7..7fe4e5e 100644 --- a/tests/NativeResolverTests.cpp +++ b/tests/NativeResolverTests.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -102,12 +103,12 @@ namespace } }; - const ResolvedRegistryNode ®istry_node(const ResolvedGraph &graph, const std::string &name) + const ResolvedRegistryNode ®istry_node(const ResolvedGraph &graph, std::string_view name) { const auto found = std::find_if(graph.nodes.begin(), graph.nodes.end(), [&](const auto &node) { const auto *registry = std::get_if(&node); - return registry && registry->identity.name == name; + return registry && std::string_view{registry->identity.name} == name; }); assert(found != graph.nodes.end()); return std::get(*found);