#!/bin/sh # Copies the UI-free Swift sources of filius-ipad, at the commit the port # follows, into Sources/FiliusCore and applies the Linux patches. set -eu here="$(cd "$(dirname "$0")" && pwd)" commit=3b5ded0 upstream="$here/.upstream" if [ ! -d "$upstream/.git" ]; then git clone -q https://github.com/filius-project/filius-ipad "$upstream" fi git -C "$upstream" fetch -q origin git -C "$upstream" checkout -q "$commit" core="$here/Sources/FiliusCore" rm -rf "$core" mkdir -p "$core" editor="$upstream/ios/FiliusPad/TopologyEditor" cp "$editor"/State/*.swift "$editor"/State/Reports/*.swift "$editor"/Model/*.swift \ "$editor"/Persistence/*.swift "$upstream/ios/FiliusPad/Localization/FiliusLocalization.swift" "$core/" # Apple's Network framework has no Linux counterpart; the LAN transport of the # remote link is not needed to replay a simulation. rm "$core/TopologyRemoteLinkLANController.swift" for patch in "$here"/patches/*.patch; do (cd "$core" && patch -p1 --forward --quiet < "$patch") done echo "filius-ipad $commit → $core ($(ls "$core" | wc -l) files)"