|
|
@ -3,20 +3,31 @@ |
|
|
|
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime") |
|
|
|
(import &comptime-only "ComptimeHelpers.cake" "BuildTools.cake") |
|
|
|
|
|
|
|
;; Define 'Dependencies-Clone-Only to clone only - useful if you don't want to or cannot use git |
|
|
|
;; submodules. For example, gamelib/test clones so I don't need to keep removing the test Dependencies. |
|
|
|
;; TODO Pitfall: This will pull master, which we might not know works. We need to specify a branch |
|
|
|
(defmacro add-dependency-git-submodule (hook-name symbol repository-url string output-directory string) |
|
|
|
(tokenize-push output |
|
|
|
(defun-comptime (token-splice hook-name) (manager (& ModuleManager) module (* Module) &return bool) |
|
|
|
(unless (fileExists (token-splice output-directory)) |
|
|
|
(Logf "%s: Automatically adding as submodule from %s\\n\\n" |
|
|
|
(token-splice output-directory) (token-splice repository-url)) |
|
|
|
(run-process-sequential-or |
|
|
|
("git" "submodule" "add" (token-splice repository-url) (token-splice output-directory)) |
|
|
|
(Logf "error: failed to add %s as a git submodule dependency. Are you in a git repository?\\n" |
|
|
|
(token-splice output-directory)) |
|
|
|
(return false)) |
|
|
|
(comptime-cond |
|
|
|
('Dependencies-Clone-Only |
|
|
|
(Logf "%s: Cloning from %s. Will NOT be tracked as a submodule\\n\\n" |
|
|
|
(token-splice output-directory) (token-splice repository-url)) |
|
|
|
(run-process-sequential-or |
|
|
|
("git" "clone" (token-splice repository-url) (token-splice output-directory)) |
|
|
|
(Logf "error: failed to clone %s\\n" (token-splice output-directory)) |
|
|
|
(return false))) |
|
|
|
(true |
|
|
|
(Logf "%s: Automatically adding as submodule from %s\\n\\n" |
|
|
|
(token-splice output-directory) (token-splice repository-url)) |
|
|
|
(run-process-sequential-or |
|
|
|
("git" "submodule" "add" (token-splice repository-url) (token-splice output-directory)) |
|
|
|
(Logf "error: failed to add %s as a git submodule dependency. Are you in a git repository?\\n" |
|
|
|
(token-splice output-directory)) |
|
|
|
(return false)))) |
|
|
|
|
|
|
|
;; Add its submodules as well |
|
|
|
;; Initialize its submodules, in case it has them |
|
|
|
(run-process-sequential-or |
|
|
|
("git" "submodule" "update" "--init" "--recursive" :in-directory (token-splice output-directory)) |
|
|
|
(Logf "error: failed to initialize submodules belonging to %s\\n" |
|
|
|