#!/bin/bash # Outputs a build.ninja script for placing into $1 (or output/ if omitted) scriptdir="$(dirname -- "${BASH_SOURCE[0]}")" builddir="${1-output}" cue_sources=( "$scriptdir"/*.cue "$scriptdir"/*.yaml ) everything="$(cue export -- "${cue_sources[@]}" | jq -c)" ASSET_TO_JSON="| to_entries[] | .value + { name: .key }" mapfile -t assets < <(jq -c ".assets $ASSET_TO_JSON" <<<"$everything") mapfile -t pseudos < <(jq -c ".pseudoassets $ASSET_TO_JSON" <<<"$everything") # base is the directory that contains the script base="$(realpath -s --relative-to="$builddir" "$scriptdir")" # root is the directory that the assets are generated into root=. relative_cue_sources=( ) for cue_source in "${cue_sources[@]}"; do relative_cue_sources+=( "$base/$cue_source" ) done cat <&2 ;; esac # always run convert if print is non-empty if [ -n "$print" ]; then cat <