Parcourir la source

nob: use new command API in stage1

rexim il y a 1 mois
Parent
commit
8a795807a7
2 fichiers modifiés avec 18 ajouts et 17 suppressions
  1. 17 17
      nob.c
  2. 1 0
      src/plug.c

+ 17 - 17
nob.c

@@ -1,6 +1,7 @@
 #define NOB_IMPLEMENTATION
 #define NOB_STRIP_PREFIX
-#define NOB_EXPERIMENTAL_DELETE_OLD
+// #define NOB_EXPERIMENTAL_DELETE_OLD // Doesn't work on Windows
+// #define NOB_WARN_DEPRECATED
 #include "./thirdparty/nob.h"
 #include "./src_build/configurer.c"
 
@@ -8,22 +9,22 @@ int main(int argc, char **argv)
 {
     NOB_GO_REBUILD_URSELF_PLUS(argc, argv, "./thirdparty/nob.h", "./src_build/configurer.c");
 
-    const char *program = nob_shift_args(&argc, &argv);
+    const char *program = shift_args(&argc, &argv);
 
     const char *old_build_conf_path = "./build/build.conf";
-    int build_conf_exists = nob_file_exists(old_build_conf_path);
+    int build_conf_exists = file_exists(old_build_conf_path);
     if (build_conf_exists < 0) return 1;
     if (build_conf_exists) {
         // @backcomp
-        nob_log(NOB_ERROR, "We found %s. That means your build folder has an old schema.", old_build_conf_path);
-        nob_log(NOB_ERROR, "Instead of %s you are suppose to use %s to configure the build now.", old_build_conf_path, CONFIG_PATH);
-        nob_log(NOB_ERROR, "Remove your ./build/ folder and run %s again to regenerate the folder with the new schema.", program);
+        nob_log(ERROR, "We found %s. That means your build folder has an old schema.", old_build_conf_path);
+        nob_log(ERROR, "Instead of %s you are suppose to use %s to configure the build now.", old_build_conf_path, CONFIG_PATH);
+        nob_log(ERROR, "Remove your ./build/ folder and run %s again to regenerate the folder with the new schema.", program);
         return 1;
     }
 
-    nob_log(NOB_INFO, "--- STAGE 1 ---");
+    nob_log(INFO, "--- STAGE 1 ---");
 
-    if (!nob_mkdir_if_not_exists("build")) return 1;
+    if (!mkdir_if_not_exists("build")) return 1;
 
     if (argc > 0) {
         const char *command_name = shift(argv, argc);
@@ -53,25 +54,24 @@ int main(int argc, char **argv)
         }
     }
 
-    int config_exists = nob_file_exists(CONFIG_PATH);
+    int config_exists = file_exists(CONFIG_PATH);
     if (config_exists < 0) return 1;
     if (config_exists == 0) {
         if (!generate_default_config(CONFIG_PATH)) return 1;
     } else {
-        nob_log(NOB_INFO, "file `%s` already exists", CONFIG_PATH);
+        nob_log(INFO, "file `%s` already exists", CONFIG_PATH);
     }
 
     if (!generate_config_logger("build/config_logger.c")) return 1;
 
-    Nob_Cmd cmd = {0};
+    Cmd cmd = {0};
     const char *stage2_binary = "build/nob_stage2";
-    nob_cmd_append(&cmd, NOB_REBUILD_URSELF(stage2_binary, "./src_build/nob_stage2.c"));
-    if (!nob_cmd_run_sync(cmd)) return 1;
+    cmd_append(&cmd, NOB_REBUILD_URSELF(stage2_binary, "./src_build/nob_stage2.c"));
+    if (!cmd_run(&cmd)) return 1;
 
-    cmd.count = 0;
-    nob_cmd_append(&cmd, stage2_binary);
-    nob_da_append_many(&cmd, argv, argc);
-    if (!nob_cmd_run_sync(cmd)) return 1;
+    cmd_append(&cmd, stage2_binary);
+    da_append_many(&cmd, argv, argc);
+    if (!cmd_run(&cmd)) return 1;
 
     return 0;
 }

+ 1 - 0
src/plug.c

@@ -11,6 +11,7 @@
 #include "ffmpeg.h"
 #define NOB_IMPLEMENTATION
 #define NOB_STRIP_PREFIX
+// #define NOB_WARN_DEPRECATED
 #include "thirdparty/nob.h"
 #include "thirdparty/tinyfiledialogs.h"