#!/usr/bin/env bash # Fetch Nothing's Glyph Matrix SDK into app/libs/. # # The .aar is not on Maven and its licence (clause 2.1(c)) forbids # redistribution, so it cannot be committed — hence this script and the # .gitignore entry. Without it the build still works: `app/build.gradle.kts` # compiles the no-op display instead and the rear matrix is simply inert. # # ./fetch-glyph-sdk.sh # or: make glyph-sdk set -euo pipefail HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) DEST="$HERE/app/libs/glyph-matrix-sdk-2.0.aar" KIT=https://github.com/Nothing-Developer-Programme/GlyphMatrix-Developer-Kit RAW="$KIT/raw/main/glyph-matrix-sdk-2.0.aar" if [[ -f $DEST && ${1:-} != --force ]]; then echo "already present: $DEST" echo "(pass --force to re-download)" exit 0 fi mkdir -p "$(dirname "$DEST")" echo "downloading the Glyph Matrix SDK from $KIT" tmp=$(mktemp) trap 'rm -f "$tmp"' EXIT curl -fsSL -o "$tmp" "$RAW" # An .aar is a zip holding classes.jar; a redirect to an HTML error page is not. if ! unzip -l "$tmp" 2>/dev/null | grep -q classes.jar; then echo "error: what came back is not an .aar. Download it by hand from" >&2 echo " $KIT" >&2 echo "and put it at $DEST" >&2 exit 1 fi mv "$tmp" "$DEST" trap - EXIT echo "installed $DEST ($(du -h "$DEST" | cut -f1))" echo echo "Licence: Nothing's Glyph SDK EULA — see $KIT/blob/main/LICENSE.md." echo "It is not redistributable, which is why this file is git-ignored."