Browse Source

Made it possible to run tests without submodules

This reduces the number of steps to clean up tests/
windows-imgui
Macoy Madson 2 years ago
parent
commit
c2f7bac6f7
  1. 1
      .gitignore
  2. 27
      src/Dependencies.cake
  3. 3
      test/Build.sh
  4. 3
      test/src/Config_Linux.cake

1
.gitignore

@ -56,6 +56,7 @@ test/SDLOgreApp
test/out.dat
test/converted.dat
test/Loader
test/Dependencies
*.log

27
src/Dependencies.cake

@ -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"

3
test/Build.sh

@ -15,10 +15,11 @@ echo "\n\nOgre\n\n"
$CAKELISP src/Config_Linux.cake src/OgreApp.cake || exit $?
echo "\n\nSDL Ogre\n\n"
$CAKELISP src/Config_Linux.cake src/SDLOgreApp.cake || exit $?
# echo "\n\nAuto Test (Math only)\n\n"
# $CAKELISP --execute src/Config_Linux.cake src/AutoTest.cake src/Math.cake || exit $?
echo "\n\nAuto Test\n\n"
$CAKELISP src/Config_Linux.cake ../src/AutoTest.cake ../src/SDL.cake ../src/Math.cake ../src/Aubio.cake || exit $?
$CAKELISP --execute src/Config_Linux.cake ../src/AutoTest.cake ../src/SDL.cake ../src/Math.cake ../src/Aubio.cake || exit $?
# $CAKELISP src/Config_Linux.cake ../src/AutoTest.cake ../src/SDL.cake ../src/Tracy.cake ../src/Math.cake ../src/Aubio.cake || exit $?
echo "\n\nVocal Game (hot reload)\n\n"

3
test/src/Config_Linux.cake

@ -2,3 +2,6 @@
(comptime-define-symbol 'Unix)
;; Building from test/, need to go up one into gamelib (a bit unusual)
(add-cakelisp-search-directory "../src")
;; Need to define this to not have to manually delete dependencies after testing is done
(comptime-define-symbol 'Dependencies-Clone-Only)

Loading…
Cancel
Save