#!/usr/bin/env bash # Author: cirakg & claude ai # Summary: Build the signed .iq package for the Connect IQ Store beta, plus release .prg files for sideload tests. # # Usage: package.sh [DEVICE ...] (devices for the .prg files; default: TEST_DEVICES) # Output: build/package/otp-wallet-.iq all 72 products, release, signed # build/package/prg/.prg release builds for sideload tests # # The .iq is what you upload as a beta app (README section 4). It is built # with the same strict settings as every other build: type check level 3 and # no compiler warnings. set -euo pipefail # shellcheck source=ciq-env.sh source "$(dirname "${BASH_SOURCE[0]}")/ciq-env.sh" ciq_require_sdk ciq_require_key version="$(sed -n 's/^ *const VERSION = "\([0-9.]*\)";.*/\1/p' /work/source/app/AppInfo.mc)" [[ -n "${version}" ]] || die "could not read VERSION from source/app/AppInfo.mc" out="${BUILD_DIR}/package" mkdir -p "${out}/prg" iq="${out}/otp-wallet-${version}.iq" compile_log="${out}/otp-wallet-${version}.log" log "exporting ${iq#/work/} for every product in manifest.xml (this takes a while)" if ! monkeyc -e -r -f "/work/monkey.jungle;/work/icons.jungle" -o "${iq}" -y "${DEV_KEY}" -l 3 -w \ >"${compile_log}" 2>&1; then cat "${compile_log}" >&2 die "packaging failed" fi if grep -q "^WARNING" "${compile_log}"; then grep "^WARNING" "${compile_log}" >&2 die "compiler warnings while packaging; warnings count as errors" fi devices=("$@") ((${#devices[@]} > 0)) || read -r -a devices <<<"${TEST_DEVICES:-}" for device in "${devices[@]}"; do build-app.sh release "${device}" cp "${BUILD_DIR}/release/${device}.prg" "${out}/prg/${device}.prg" done # Keep the upstream notices and project license with the binary artifacts. # The distributor must also provide the corresponding GPL-covered source. cp /work/LICENSE /work/THIRD_PARTY_NOTICES.md "${out}/" mkdir -p "${out}/LICENSES" cp /work/LICENSES/segno.txt /work/LICENSES/pdf417gen.txt "${out}/LICENSES/" log "package ready: ${iq#/work/} ($(du -h "${iq}" | cut -f1)); release .prg files in build/package/prg/"