kaleidoscope-builder: Support examples in subdirs

For better organisation, we're putting examples in subdirectories of
`examples/`. The builder should support that.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/472/head
Gergely Nagy 6 years ago
parent 50a6f5e1b1
commit f27a2127ac
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -249,12 +249,19 @@ compile () {
_find_all () { _find_all () {
for plugin in ./*.ino \ for plugin in ./*.ino \
examples/* \ $([ -d examples ] && find examples -name '*.ino') \
src/*.ino; do src/*.ino; do
if [ -d "$(dirname "${plugin}")" ] || [ -f "${plugin}" ]; then if [ -d "$(dirname "${plugin}")" ] || [ -f "${plugin}" ]; then
p="$(basename "${plugin}" .ino)" p="$(basename "${plugin}" .ino)"
if [ "${p}" != '*' ]; then if [ "${p}" != '*' ]; then
echo "${p}" case "${plugin}" in
examples/*/${p}/${p}.ino)
echo "${plugin}" | sed -e "s,examples/,," | sed -e "s,/${p}\\.ino,,"
;;
*)
echo "${p}"
;;
esac
fi fi
fi fi
done | sort done | sort
@ -497,6 +504,12 @@ done
LIBRARY="${SKETCH}" LIBRARY="${SKETCH}"
case "${SKETCH}" in
*/*)
SKETCH="$(basename "${SKETCH}")"
;;
esac
export SKETCH export SKETCH
export LIBRARY export LIBRARY

Loading…
Cancel
Save