added: check that git is installed in onyx package dev
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 29 Nov 2023 01:21:39 +0000 (19:21 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 29 Nov 2023 01:21:39 +0000 (19:21 -0600)
CHANGELOG
scripts/onyx-pkg.onyx

index d0b70f2397ff2e8f590c701323459cb4aca24ab9..9eea6f2e9370336bf6178563477f05ea91c4cbff 100644 (file)
--- 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 <config_name>'
 
 Removals:
 
index b497bef57e97268acc69b4ce51ada4ea84fd670c..bfc85744c7381036864e5b2f5196c30c012629ef 100644 (file)
@@ -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 {