From e76a998ac371be5fe0d58c3d4e7f83a1d700c0cf Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Tue, 28 Nov 2023 19:21:39 -0600 Subject: [PATCH] added: check that git is installed in onyx package --- CHANGELOG | 5 +++++ scripts/onyx-pkg.onyx | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d0b70f23..9eea6f2e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,11 @@ Additions: - Supported on WASIX and Onyx runtime - `os.getcwd` for getting the current directory - Supported on WASIX and Onyx runtime +- Basic build configurations into package manager. + - Configure sources files, runtime, target file, + included files, and CLI arguments + - Multiple configurations per project. + - Build with 'onyx package build ' Removals: diff --git a/scripts/onyx-pkg.onyx b/scripts/onyx-pkg.onyx index b497bef5..bfc85744 100644 --- a/scripts/onyx-pkg.onyx +++ b/scripts/onyx-pkg.onyx @@ -59,6 +59,13 @@ main :: (args: [] cstr) { return; } + if !Git.test_for_git() { + error_print("onyx package requires Git to be installed and accessible."); + info_print("", "Ensure Git is installed on your system.\n"); + os.exit(1); + return; + } + loaded_config_file := false; defer if loaded_config_file do store_config_file(); @@ -946,6 +953,14 @@ Package :: struct { } Git :: struct { + test_for_git :: () -> bool { + p := os.process_spawn(git_path, .[]); + return switch os.process_wait(&p) { + case .Success => true; + case #default => false; + }; + } + get_full_repo_uri :: (package_search: str) -> str { for Known_Repositories { for proto: Protocols { -- 2.25.1