mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-21 06:14:35 +00:00
Avoid fetching some repos twice
Also enables a nice bit of logic cleanup
This commit is contained in:
+19
-19
@@ -27,16 +27,15 @@ foreach(component "asm" "link" "fix" "gfx")
|
||||
endforeach()
|
||||
set_tests_properties(rgbgfx PROPERTIES REQUIRED_FILES "$<TARGET_FILE:rgbgfx>;$<TARGET_FILE:randtilegen>;$<TARGET_FILE:rgbgfx_test>")
|
||||
|
||||
add_test(NAME fetch-test-deps
|
||||
add_test(NAME fetch-free-deps
|
||||
COMMAND bash -- external/fetch-repos.sh --only-free
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(fetch-test-deps PROPERTIES FIXTURES_SETUP "free-repos"
|
||||
LABELS "external")
|
||||
set_tests_properties(fetch-free-deps PROPERTIES FIXTURES_SETUP "free-repos"
|
||||
LABELS "external;free")
|
||||
add_test(NAME fetch-nonfree-deps
|
||||
COMMAND bash -- external/fetch-repos.sh
|
||||
COMMAND bash -- external/fetch-repos.sh --only-nonfree
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(fetch-nonfree-deps PROPERTIES FIXTURES_SETUP "external-repos" # *All* external repos.
|
||||
FIXTURES_REQUIRED "free-repos" # Sequence after the other to avoid concurrent access.
|
||||
set_tests_properties(fetch-nonfree-deps PROPERTIES FIXTURES_SETUP "nonfree-repos"
|
||||
LABELS "external;nonfree")
|
||||
|
||||
file(GLOB ext_projects "external/*.cfg") # This will not be re-computed if a new project is added! You must manually reconfigure.
|
||||
@@ -45,26 +44,27 @@ foreach(cfg_file IN LISTS ext_projects)
|
||||
|
||||
# Parse the config file, using it to set some variables for more convenient access.
|
||||
file(STRINGS "${cfg_file}" proj_props REGEX "^[^# \t]*[^#]") # Ignore comments and empty lines.
|
||||
foreach(line LIST proj_props)
|
||||
string(REGEX MATCH "^[ \t]*EXT_TEST_([A-Za-z0-9_]+)=(.+)" matched "${line}")
|
||||
set(${project}_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}")
|
||||
foreach(line IN LISTS proj_props)
|
||||
string(REGEX MATCH "^[ \t]*EXT_TEST_([A-Za-z0-9_]+)=(.+)\$" matched "${line}")
|
||||
if(NOT matched STREQUAL "")
|
||||
set(${project}_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Wire it up according to whether it's free (as in speech) or not.
|
||||
if(${project}_IS_NONFREE)
|
||||
set(freedom "nonfree")
|
||||
else()
|
||||
set(freedom "free")
|
||||
endif()
|
||||
|
||||
add_test(NAME "${project}"
|
||||
COMMAND bash -- external/test.sh ${project}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_tests_properties(${project} PROPERTIES DEPENDS "rgbasm;rgblink;rgbfix;rgbgfx" # Only attempt building whole projects if each tool passes muster on its own.
|
||||
PROCESSORS 4
|
||||
LABELS "external;${project}")
|
||||
|
||||
# Wire it up according to whether it's free (as in speech) or not.
|
||||
if(${project}_IS_NONFREE)
|
||||
set_property(TEST "${project}" APPEND PROPERTY LABELS "nonfree")
|
||||
set_tests_properties("${project}" PROPERTIES FIXTURES_REQUIRED "external-repos")
|
||||
else()
|
||||
set_property(TEST "${project}" APPEND PROPERTY LABELS "free")
|
||||
set_tests_properties("${project}" PROPERTIES FIXTURES_REQUIRED "free-repos")
|
||||
endif()
|
||||
LABELS "external;${project};${freedom}"
|
||||
FIXTURES_REQUIRED "${freedom}-repos")
|
||||
endforeach()
|
||||
|
||||
# gb-starter kit fails with any `make` on Windows: https://codeberg.org/ISSOtm/gb-starter-kit/issues/1
|
||||
|
||||
Vendored
+18
-3
@@ -17,6 +17,7 @@ EOF
|
||||
# Parse options in pure Bash because macOS `getopt` is stuck
|
||||
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
||||
nonfree=true
|
||||
free=true
|
||||
actionname=
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
@@ -27,6 +28,9 @@ while [[ $# -gt 0 ]]; do
|
||||
--only-free)
|
||||
nonfree=false
|
||||
;;
|
||||
--only-nonfree)
|
||||
free=false
|
||||
;;
|
||||
--get-hash|--get-paths)
|
||||
actionname="$1"
|
||||
;;
|
||||
@@ -41,6 +45,11 @@ while [[ $# -gt 0 ]]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if ! "$nonfree" && ! "$free"; then
|
||||
echo "Specifying --only-nonfree with --only-free is a contradiction"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$actionname" in
|
||||
--get-hash)
|
||||
action() {
|
||||
@@ -76,8 +85,14 @@ esac
|
||||
for cfg in *.cfg; do (
|
||||
# Sourcing "$cfg" defines `EXT_TEST_*` variables that get used by `action`.
|
||||
. "$cfg"
|
||||
# Only run a nonfree action if nonfree tests are opted into.
|
||||
if ! $EXT_TEST_IS_NONFREE || $nonfree; then
|
||||
action
|
||||
|
||||
if $EXT_TEST_IS_NONFREE; then
|
||||
if $nonfree; then
|
||||
action
|
||||
fi
|
||||
else
|
||||
if $free; then
|
||||
action
|
||||
fi
|
||||
fi
|
||||
); done
|
||||
|
||||
Reference in New Issue
Block a user