Skip to content

Commit

Permalink
Rollback support for yq v3
Browse files Browse the repository at this point in the history
I mean, v4 was released in 2020
  • Loading branch information
spalladino committed Jan 9, 2024
1 parent 5559d2d commit e32ed29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions build-system/scripts/query_manifest
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi

function get_deps {
local TYPE=$(yq -r ".\"$1\".dependencies | type" $MANIFEST)
if [ "$TYPE" == "!!str" ] || [ "$TYPE" == "string" ]; then
if [ "$TYPE" == "!!str" ]; then
# Execute string as command relative to buildDir to retrieve dependencies.
local BUILD_DIR=$($0 buildDir $1)
local CMD=$BUILD_DIR/$(yq -r ".\"$1\".dependencies")
Expand All @@ -24,9 +24,9 @@ function get_deps {
fi
local PROJECT_DIR=$($0 projectDir $1)
DEPS=($($CMD $PROJECT_DIR))
elif [ "$TYPE" == "!!null" ] || [ "$TYPE" == "null" ]; then
elif [ "$TYPE" == "!!null" ]; then
DEPS=()
elif [ "$TYPE" == "!!seq" ] || [ "$TYPE" == "array" ]; then
elif [ "$TYPE" == "!!seq" ]; then
DEPS=($(yq -r ".\"$1\".dependencies // [] | .[]" $MANIFEST))
else
>&2 echo "Build manifest 'dependencies' must be array, string, or null (got $TYPE)."
Expand All @@ -36,13 +36,13 @@ function get_deps {

function add_rebuild_patterns {
local TYPE=$(yq -r ".\"$1\".rebuildPatterns | type" $MANIFEST)
if [ "$TYPE" == "!!str" ] || [ "$TYPE" == "string" ]; then
if [ "$TYPE" == "!!str" ]; then
local FILE=$(yq -r ".\"$1\".rebuildPatterns" $MANIFEST)
local PROJECT_DIR=$($0 projectDir $1)
PATTERNS=(${PATTERNS[@]} $(cat $PROJECT_DIR/$FILE))
elif [ "$TYPE" == "!!seq" ] || [ "$TYPE" == "array" ]; then
elif [ "$TYPE" == "!!seq" ]; then
PATTERNS=(${PATTERNS[@]} $(yq -r ".\"$1\".rebuildPatterns | .[]" $MANIFEST))
elif [ "$TYPE" == "!!null" ] || [ "$TYPE" == "null" ]; then
elif [ "$TYPE" == "!!null" ]; then
local PROJECT_DIR=$($0 relativeProjectDir $1)
PATTERNS=(${PATTERNS[@]} "^$PROJECT_DIR/")
else
Expand Down

0 comments on commit e32ed29

Please sign in to comment.