mirror of
https://github.com/Aminark/legado-ios.git
synced 2026-10-22 20:01:23 +08:00
- 书架和文件管理统一使用 TXT 文件选择器,支持大小写扩展名及多选,排除 JSON 书源 - 保留所选文件访问权限至异步导入完成,等待选择器关闭后展示导入确认 - 补充双入口文件选择回归、导入校验和 TXT 测试样本
46 lines
2.2 KiB
Bash
46 lines
2.2 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
printf 'Usage: sh scripts/prepare-source-import-fixture.sh <booted-simulator-UUID>\n' >&2
|
|
exit 2
|
|
fi
|
|
|
|
legado_fixture_device="$1"
|
|
legado_fixture_repo="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
|
legado_fixture_build="$(mktemp -d "${TMPDIR:-/tmp}/legado-source-import.XXXXXX")"
|
|
trap 'rm -rf "$legado_fixture_build"' EXIT HUP INT TERM
|
|
legado_fixture_app="$legado_fixture_build/SourceImportFixtures.app"
|
|
legado_fixture_sdk="$(xcrun --sdk iphonesimulator --show-sdk-path)"
|
|
legado_fixture_arch="$(uname -m)"
|
|
mkdir -p "$legado_fixture_app"
|
|
|
|
cat > "$legado_fixture_app/Info.plist" <<'PLIST'
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0"><dict>
|
|
<key>CFBundleIdentifier</key><string>com.epiboly.legado.source-import-fixtures</string>
|
|
<key>CFBundleExecutable</key><string>SourceImportFixtures</string>
|
|
<key>CFBundleName</key><string>SourceImportFixtures</string>
|
|
<key>CFBundleDisplayName</key><string>书源导入测试</string>
|
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
<key>CFBundleVersion</key><string>1</string>
|
|
<key>CFBundleShortVersionString</key><string>1.0</string>
|
|
<key>MinimumOSVersion</key><string>15.0</string>
|
|
<key>LSRequiresIPhoneOS</key><true/>
|
|
<key>UIFileSharingEnabled</key><true/>
|
|
<key>LSSupportsOpeningDocumentsInPlace</key><true/>
|
|
<key>UILaunchScreen</key><dict/>
|
|
<key>UISupportedInterfaceOrientations</key><array><string>UIInterfaceOrientationPortrait</string></array>
|
|
</dict></plist>
|
|
PLIST
|
|
|
|
xcrun --sdk iphonesimulator swiftc -parse-as-library -swift-version 6 \
|
|
-sdk "$legado_fixture_sdk" -target "$legado_fixture_arch-apple-ios15.0-simulator" \
|
|
-module-cache-path "$legado_fixture_repo/DerivedData/ModuleCache.noindex" \
|
|
"$legado_fixture_repo/scripts/fixtures/SourceImportFixture.swift" \
|
|
-o "$legado_fixture_app/SourceImportFixtures"
|
|
xcrun simctl install "$legado_fixture_device" "$legado_fixture_app"
|
|
xcrun simctl launch --terminate-running-process "$legado_fixture_device" com.epiboly.legado.source-import-fixtures
|
|
printf 'JSON and TXT import fixtures are ready in Files > On My iPhone > 书源导入测试.\n'
|