Plezy consumed mpv through four unrelated supply chains: an MPVKit fork via SwiftPM for the Apple platforms, a libmpv-android fork's AAR for Android, an in-CI from-source build for Linux, and an unpinned sourceforge mpv-dev 7z for Windows. All four now consume the same per-commit, content-addressed binaries from https://github.com/edde746/mpv-build, pinned to one commit and built from one set of pinned sources (mpv v0.41.0 on Apple/Android/Windows, ffmpeg n8.0.1, our libass fork). - Apple: the SwiftPM package moves from edde746/MPVKit to edde746/mpv-build across the ios/macos/tvos projects; scripts/set_mpvkit_revision.sh becomes set_native_revision.sh, writes every pin site plus the new repo-root mpv-build.lock.json, and tvos/scripts/wire_mpv.rb derives the package repo from the locks. - Android: the mpv Kotlin API and JNI glue move in-app under android/libmpv (repackaged com.edde746.plezy.libmpv, exports renamed, shrinker rules covered), and the module downloads per-ABI native tarballs (lib/*.so incl. libc++_shared.so + include/) driven entirely by mpv-build.lock.json, with a PLEZY_LOCAL_MPV_DIR escape hatch for locally built artifacts. The fork AAR and its Maven coordinates are gone. - Linux: CI downloads the prebuilt self-relocating libmpv prefix (lock-driven, sha256-verified) instead of compiling mpv/ffmpeg/dav1d/ libplacebo/shaderc from source; linux/packaging/build-libmpv.sh and its test are deleted and native-inputs.json shrinks to the simdutf entry the CMake builds still fetch. - Windows: both arches FetchContent the mpv-build dev zips with URL_HASH enforcement, replacing the checksum-less sourceforge download and its ARM64 7-Zip special case; guard scripts updated. The lock plus the Apple pin sites all point at mpv-build commit d7c3d559, whose manifest was verified asset-by-asset against the published release digests (17/17 match). Verified locally: wire and pin-script suites green, runtime-input checks green, all four Android ABI tarballs downloaded/verified/extracted through the real Gradle tasks, the Windows FetchContent block exercised end to end through cmake, the Linux asset hash and layout checked against the workflow contract, and xcodebuild resolved the flipped SwiftPM graph with SwiftPM validating every binary checksum.
123 lines
4.2 KiB
Bash
Executable File
123 lines
4.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Re-resolve Plezy's Apple SwiftPM dependencies so a moved pin is actually fetched.
|
|
#
|
|
# Why this exists: the locks name a revision, but nothing in a normal Flutter
|
|
# build ever fetches it. `flutter run/build -d macos` runs its Xcode steps with
|
|
# `-skipPackageUpdates`, which forbids contacting the remote, and the one
|
|
# fetch-capable step Flutter does perform (`prefetchSwiftPackages`) is started
|
|
# for at most one Darwin platform per invocation -- iOS wins, because a single
|
|
# `_swiftPackageFetchProcess` field in flutter_tools guards it. So on a checkout
|
|
# whose build/macos/SourcePackages predates the pin, every macOS build dies in
|
|
# the SwiftPM integration migration with:
|
|
#
|
|
# could not find the commit <sha> in https://github.com/edde746/MPVKit
|
|
#
|
|
# even though the commit is perfectly reachable upstream. The mirror is stale,
|
|
# the fetch is forbidden, and nothing self-heals. One `-resolvePackageDependencies`
|
|
# without those flags updates the mirror, materializes the checkout, and leaves
|
|
# the tracked locks untouched.
|
|
#
|
|
# Run this after scripts/set_native_revision.sh, or after pulling someone else's
|
|
# pin bump, whenever a macOS build reports a commit it cannot find.
|
|
#
|
|
# Usage:
|
|
# scripts/refresh_apple_spm.sh [--reset] [ios|macos ...]
|
|
#
|
|
# Defaults to every supported platform. tvOS is deliberately absent: it is not
|
|
# built through Flutter, and Xcode resolves it with fetching enabled anyway.
|
|
#
|
|
# --reset deletes the platform's SourcePackages directory first. Needed only when
|
|
# that directory is internally inconsistent -- a workspace-state.json naming a
|
|
# checkout that no longer exists makes SwiftPM refuse to resolve at all. Binary
|
|
# artifacts re-hydrate from ~/Library/Caches/org.swift.swiftpm, so a reset costs
|
|
# seconds, not a re-download.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
SUPPORTED=(ios macos)
|
|
RESET=0
|
|
PLATFORMS=()
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--reset)
|
|
RESET=1
|
|
;;
|
|
-h | --help)
|
|
# Print the header block itself, so help can never drift from the comments.
|
|
awk 'NR > 1 && /^#/ { sub(/^# ?/, ""); print; next } NR > 1 { exit }' "${BASH_SOURCE[0]}"
|
|
exit 0
|
|
;;
|
|
-*)
|
|
echo "error: unknown option '$arg'" >&2
|
|
exit 2
|
|
;;
|
|
*)
|
|
valid=0
|
|
for platform in "${SUPPORTED[@]}"; do
|
|
[ "$arg" = "$platform" ] && valid=1
|
|
done
|
|
if [ "$valid" -eq 0 ]; then
|
|
echo "error: unsupported platform '$arg' (expected: ${SUPPORTED[*]})" >&2
|
|
exit 2
|
|
fi
|
|
PLATFORMS+=("$arg")
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ "${#PLATFORMS[@]}" -eq 0 ]; then
|
|
PLATFORMS=("${SUPPORTED[@]}")
|
|
fi
|
|
|
|
if ! command -v xcodebuild >/dev/null 2>&1; then
|
|
echo "error: xcodebuild not found; this script only runs on a macOS host with Xcode" >&2
|
|
exit 1
|
|
fi
|
|
|
|
FAILED=0
|
|
|
|
for platform in "${PLATFORMS[@]}"; do
|
|
project="$platform/Runner.xcodeproj"
|
|
if [ ! -d "$project" ]; then
|
|
echo "skip $platform (no $project)"
|
|
continue
|
|
fi
|
|
# The graph includes Flutter's generated local packages; without them xcodebuild
|
|
# fails on a missing manifest rather than on anything to do with the pin.
|
|
if [ ! -d "$platform/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" ]; then
|
|
echo "error: $platform/Flutter/ephemeral/Packages is missing; run 'flutter pub get' first" >&2
|
|
FAILED=1
|
|
continue
|
|
fi
|
|
|
|
cloned_dir="$ROOT/build/$platform/SourcePackages"
|
|
if [ "$RESET" -eq 1 ] && [ -d "$cloned_dir" ]; then
|
|
rm -rf "$cloned_dir"
|
|
echo "reset $cloned_dir"
|
|
fi
|
|
|
|
log="$(mktemp)"
|
|
if (cd "$platform" && xcodebuild -project Runner.xcodeproj -resolvePackageDependencies \
|
|
-clonedSourcePackagesDirPath "$cloned_dir" >"$log" 2>&1); then
|
|
echo "resolved $platform"
|
|
# Only the lines that say what moved; the rest is a list of local plugin packages.
|
|
grep -E '^(Fetching|Updating|Cloning|Creating working copy|Checking out) ' "$log" | sed 's/^/ /' || true
|
|
else
|
|
echo "FAILED $platform" >&2
|
|
cat "$log" >&2
|
|
if [ "$RESET" -eq 0 ]; then
|
|
echo "hint: rerun as 'scripts/refresh_apple_spm.sh --reset $platform' if $cloned_dir is inconsistent" >&2
|
|
fi
|
|
FAILED=1
|
|
fi
|
|
rm -f "$log"
|
|
done
|
|
|
|
if [ "$FAILED" -ne 0 ]; then
|
|
exit 1
|
|
fi
|