SwiftUI app against master API: link, profiles, browse, live TV, favorites sync, and TestFlight-ready assets. Co-authored-by: Cursor <cursoragent@cursor.com>
94 lines
3.2 KiB
Bash
94 lines
3.2 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
IOS="$HOME/Code/mediacluster/apps/ios"
|
|
mkdir -p "$IOS/Vendor"
|
|
rm -rf "$IOS/Vendor/MobileVLCKit.xcframework"
|
|
cp -R /tmp/vlcunpack/MobileVLCKit-binary/MobileVLCKit.xcframework "$IOS/Vendor/"
|
|
ls "$IOS/Vendor/MobileVLCKit.xcframework"
|
|
|
|
python3 <<'PY'
|
|
from pathlib import Path
|
|
import uuid, re
|
|
|
|
pbx_path = Path.home() / "Code/mediacluster/apps/ios/VMC.xcodeproj/project.pbxproj"
|
|
text = pbx_path.read_text()
|
|
if "MobileVLCKit.xcframework" in text:
|
|
print("Already linked")
|
|
raise SystemExit(0)
|
|
|
|
def nid():
|
|
return uuid.uuid4().hex[:24].upper()
|
|
|
|
fw_ref, fw_build, embed_build, embed_phase = nid(), nid(), nid(), nid()
|
|
|
|
text = text.replace(
|
|
"/* End PBXFileReference section */",
|
|
f'\t\t{fw_ref} /* MobileVLCKit.xcframework */ = {{isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MobileVLCKit.xcframework; path = Vendor/MobileVLCKit.xcframework; sourceTree = "<group>"; }};\n/* End PBXFileReference section */',
|
|
)
|
|
|
|
text = text.replace(
|
|
"/* End PBXBuildFile section */",
|
|
(
|
|
f"\t\t{fw_build} /* MobileVLCKit.xcframework in Frameworks */ = {{isa = PBXBuildFile; fileRef = {fw_ref} /* MobileVLCKit.xcframework */; }};\n"
|
|
f"\t\t{embed_build} /* MobileVLCKit.xcframework in Embed Frameworks */ = {{isa = PBXBuildFile; fileRef = {fw_ref} /* MobileVLCKit.xcframework */; settings = {{ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }}; }};\n"
|
|
"/* End PBXBuildFile section */"
|
|
),
|
|
)
|
|
|
|
text = re.sub(
|
|
r"(isa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = \()\n(\t\t\t\);)",
|
|
rf"\1\n\t\t\t\t{fw_build} /* MobileVLCKit.xcframework in Frameworks */,\n\2",
|
|
text,
|
|
count=1,
|
|
)
|
|
|
|
if "PBXCopyFilesBuildPhase" not in text:
|
|
block = f"""/* Begin PBXCopyFilesBuildPhase section */
|
|
\t\t{embed_phase} /* Embed Frameworks */ = {{
|
|
\t\t\tisa = PBXCopyFilesBuildPhase;
|
|
\t\t\tbuildActionMask = 2147483647;
|
|
\t\t\tdstPath = "";
|
|
\t\t\tdstSubfolderSpec = 10;
|
|
\t\t\tfiles = (
|
|
\t\t\t\t{embed_build} /* MobileVLCKit.xcframework in Embed Frameworks */,
|
|
\t\t\t);
|
|
\t\t\tname = "Embed Frameworks";
|
|
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
|
\t\t}};
|
|
/* End PBXCopyFilesBuildPhase section */
|
|
|
|
"""
|
|
text = text.replace("/* Begin PBXFrameworksBuildPhase section */", block + "/* Begin PBXFrameworksBuildPhase section */")
|
|
|
|
text = re.sub(
|
|
r"(buildPhases = \(\n\t\t\t\t[A-F0-9]+ /\* Sources \*/,\n\t\t\t\t[A-F0-9]+ /\* Frameworks \*/,)",
|
|
rf"\1\n\t\t\t\t{embed_phase} /* Embed Frameworks */,",
|
|
text,
|
|
count=1,
|
|
)
|
|
|
|
# Insert into root group children (before Products)
|
|
text = re.sub(
|
|
r"(children = \(\n\t\t\t\t[A-F0-9]+ /\* VMC \*/,)\n(\t\t\t\t[A-F0-9]+ /\* Products \*/,)",
|
|
rf"\1\n\t\t\t\t{fw_ref} /* MobileVLCKit.xcframework */,\n\2",
|
|
text,
|
|
count=1,
|
|
)
|
|
|
|
# Target build settings
|
|
text = text.replace(
|
|
"MARKETING_VERSION = 0.2.0;\n",
|
|
(
|
|
"MARKETING_VERSION = 0.2.0;\n"
|
|
"\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n"
|
|
'\t\t\t\t\t"$(inherited)",\n'
|
|
'\t\t\t\t\t"$(PROJECT_DIR)/Vendor",\n'
|
|
"\t\t\t\t);\n"
|
|
"\t\t\t\tENABLE_BITCODE = NO;\n"
|
|
'\t\t\t\tOTHER_LDFLAGS = ("$(inherited)", "-ObjC");\n'
|
|
),
|
|
)
|
|
|
|
pbx_path.write_text(text)
|
|
print("Patched OK")
|
|
PY
|