diff --git a/sweetpad-cli/PLAN_LINUX.md b/sweetpad-cli/PLAN_LINUX.md index 2f4c9b44..e3a957b6 100644 --- a/sweetpad-cli/PLAN_LINUX.md +++ b/sweetpad-cli/PLAN_LINUX.md @@ -1110,7 +1110,14 @@ Clippy with `-D warnings`, formatting and diff checks also pass. - [x] App extensions and widgets: an `embeddedBinaryValidationUtility` stand-in makes Xcode's checks (bundle ID prefix, matching versions); a widget built here registers in the simulator -- [ ] App Clips +- [x] App Clips. The [delivery fixture](../sweetpad-lib/ci/fixture-delivery/README.md#app-clips) + builds a host with an embedded Clip on Linux and with Xcode. Both hosts + launch on an iPhone simulator, and each installed Clip displays a fresh + HTTPS invocation URL in XCTest. The Release device archives and Linux + development IPA match on host/Clip entitlements and bundle metadata. + Apple's tools verify both signatures, their provisioning profiles, and + both archive dSYMs. Both engines reject a signed Clip missing its parent + entitlement. - [x] Test targets: `test build` adds the selected test plan's targets, or the scheme's testables, as `build-for-testing` does, and leaves the testing frameworks out of the host app like Xcode 27. The bundle passes diff --git a/sweetpad-cli/src/cli/codesign/provisioning.rs b/sweetpad-cli/src/cli/codesign/provisioning.rs index ba3e3a13..23e16ea8 100644 --- a/sweetpad-cli/src/cli/codesign/provisioning.rs +++ b/sweetpad-cli/src/cli/codesign/provisioning.rs @@ -153,13 +153,7 @@ pub(super) fn answer( } merge(&mut entitlements, project); if let Some(profile) = &profile { - for key in ["aps-environment", "com.apple.developer.aps-environment"] { - if plist::get(&entitlements, key).is_some() - && let Some(value) = plist::get(&profile.entitlements, key) - { - plist::set(&mut entitlements, key, value.clone()); - } - } + profile.apply_capabilities(&mut entitlements, mac); } if !mac || profile.is_some() { plist::set( @@ -485,6 +479,21 @@ pub(super) fn check_entitlements( Ok(()) } +/// A signed App Clip identifies exactly one full app, including its App ID prefix. +pub(crate) fn check_clip_parent(entitlements: &Plist, host_id: &str) -> Result<(), String> { + let key = "com.apple.developer.parent-application-identifiers"; + if let Some(Plist::Array(parents)) = plist::get(entitlements, key) + && let [Plist::String(parent)] = parents.as_slice() + && parent == host_id + { + return Ok(()); + } + Err(format!( + "The {key} entitlement of an App Clip must match the application-identifier entitlement \ + ('{host_id}') of its containing parent app." + )) +} + /// Whether a profile has to grant entitlement `key`. fn provisioned(key: &str) -> bool { (key.starts_with("com.apple.developer.") && key != "com.apple.developer.team-identifier") @@ -636,6 +645,26 @@ impl Profile { } impl Profile { + /// Xcode takes the requested push environment from the profile. It also + /// signs an iOS host with its registered App Clip association, even when + /// the project has no entitlements file or this build embeds no Clip. + pub(super) fn apply_capabilities(&self, entitlements: &mut Plist, mac: bool) { + for key in ["aps-environment", "com.apple.developer.aps-environment"] { + if plist::get(entitlements, key).is_some() + && let Some(value) = plist::get(&self.entitlements, key) + { + plist::set(entitlements, key, value.clone()); + } + } + let clips = "com.apple.developer.associated-appclip-app-identifiers"; + if !mac + && plist::get(entitlements, clips).is_none() + && let Some(value) = plist::get(&self.entitlements, clips) + { + plist::set(entitlements, clips, value.clone()); + } + } + /// The application identifier it allows, with its team: exact, or a /// prefix ending in `*`. A macOS profile names it with Apple's prefix. pub fn application_identifier(&self) -> Option<&str> { diff --git a/sweetpad-cli/src/cli/codesign/resign.rs b/sweetpad-cli/src/cli/codesign/resign.rs index 035632a6..41dea3d8 100644 --- a/sweetpad-cli/src/cli/codesign/resign.rs +++ b/sweetpad-cli/src/cli/codesign/resign.rs @@ -127,12 +127,9 @@ pub(super) fn plan_with( let app = &request.app; let info = read_info(app)?; let mac = app.join("Contents").is_dir(); + let default_platform = if mac { "macosx" } else { "iphoneos" }; let platform = - provisioning::platform(plist::string(&info, "DTPlatformName").unwrap_or(if mac { - "macosx" - } else { - "iphoneos" - })); + provisioning::platform(plist::string(&info, "DTPlatformName").unwrap_or(default_platform)); let archived = archived(app)?; let team = match ( &request.team, @@ -162,7 +159,7 @@ pub(super) fn plan_with( if is_provisioned(&path) { let id = bundle_id(&path)?; let bundle = bundle.insert(id); - let archived = archived_entitlements(&path)?; + let archived = signed_entitlements(&path)?; // A Developer ID app embeds a profile only for what Apple grants // through one, or when ExportOptions names one. let provisioned = request.method != Method::DeveloperId @@ -184,6 +181,9 @@ pub(super) fn plan_with( } else { unprovisioned(archived, &team) }; + if path.parent() == Some(app.join("AppClips").as_path()) { + provisioning::check_clip_parent(&signed, &format!("{team}.{}", bundle_id(app)?))?; + } let icloud = "com.apple.developer.icloud-container-environment"; if let Some(environment) = &request.icloud_environment && plist::get(&signed, icloud).is_some() @@ -387,7 +387,8 @@ fn archived(bundle: &Path) -> Result, String> { Ok(layout.signature(&slice.data).and_then(blobs::read_existing)) } -fn archived_entitlements(bundle: &Path) -> Result { +/// The entitlements in the code signature of a bundle's main executable. +pub(crate) fn signed_entitlements(bundle: &Path) -> Result { match archived(bundle)?.and_then(|e| e.entitlements) { Some(xml) => plist::parse(&xml), None => Ok(Plist::Dict(Vec::new())), @@ -523,13 +524,7 @@ pub(super) fn transform( let allow = granted("get-task-allow").unwrap_or(Plist::Bool(false)); plist::set(&mut entitlements, "get-task-allow", allow); } - for key in ["aps-environment", "com.apple.developer.aps-environment"] { - if plist::get(&entitlements, key).is_some() - && let Some(value) = granted(key) - { - plist::set(&mut entitlements, key, value); - } - } + profile.apply_capabilities(&mut entitlements, mac); if let Some(value) = granted("beta-reports-active") { plist::set(&mut entitlements, "beta-reports-active", value); } diff --git a/sweetpad-cli/src/cli/codesign/tests.rs b/sweetpad-cli/src/cli/codesign/tests.rs index 6471ff6b..d438f7a0 100644 --- a/sweetpad-cli/src/cli/codesign/tests.rs +++ b/sweetpad-cli/src/cli/codesign/tests.rs @@ -1336,6 +1336,53 @@ fn an_export_refuses_a_profile_of_another_kind_or_a_missing_one() { assert!(teams.contains("names no team"), "{teams}"); } +#[test] +fn a_signed_app_clip_must_name_exactly_its_host() { + let host = "TESTTEAM01.dev.sweetpad.app"; + let parent = Plist::String(host.into()); + let other = Plist::String("TESTTEAM01.dev.sweetpad.other".into()); + let check = |parents| { + let rights = Plist::Dict(vec![( + "com.apple.developer.parent-application-identifiers".into(), + Plist::Array(parents), + )]); + provisioning::check_clip_parent(&rights, host) + }; + assert!(check(vec![parent.clone()]).is_ok()); + assert!(check(vec![other.clone()]).is_err()); + assert!(check(vec![parent, other]).is_err()); + assert!(provisioning::check_clip_parent(&Plist::Dict(vec![]), host).is_err()); +} + +#[test] +fn export_restores_the_profiles_app_clip_association_to_an_ad_hoc_archive() { + let mut profile = + provisioning::find_named(kind_profiles(), "Sweetpad Kinds app-store").unwrap(); + let key = "com.apple.developer.associated-appclip-app-identifiers"; + let clip = Plist::Array(vec![Plist::String( + "TESTTEAM01.dev.sweetpad.kinds.app.Clip".into(), + )]); + plist::set(&mut profile.entitlements, key, clip.clone()); + let export = |archived| { + resign::transform( + archived, + &profile, + "TESTTEAM01", + "dev.sweetpad.kinds.app", + false, + resign::Method::AppStoreConnect, + ) + }; + let signed = export(Plist::Dict(vec![])).unwrap(); + assert_eq!(plist::get(&signed, key), Some(&clip)); + + let other = Plist::Array(vec![Plist::String( + "TESTTEAM01.dev.sweetpad.other.Clip".into(), + )]); + let mismatch = export(Plist::Dict(vec![(key.into(), other)])).unwrap_err(); + assert!(mismatch.contains(key), "{mismatch}"); +} + #[test] #[allow(clippy::too_many_lines)] // one table of entitlements per method fn export_entitlements_move_to_the_profile_and_team() { diff --git a/sweetpad-cli/src/cli/darwin_tools/embedded_binary.rs b/sweetpad-cli/src/cli/darwin_tools/embedded_binary.rs index 88560e5f..c3a10e05 100644 --- a/sweetpad-cli/src/cli/darwin_tools/embedded_binary.rs +++ b/sweetpad-cli/src/cli/darwin_tools/embedded_binary.rs @@ -2,17 +2,17 @@ //! Info.plist> [-signing-cert ]`, which Swift Build runs on each app //! extension, App Clip or watch app it embeds in an app. //! -//! It makes the checks of Xcode's that hold without signing: an error when -//! the embedded bundle's identifier doesn't start with the app's, and a -//! warning when its `CFBundleVersion`, or else its -//! `CFBundleShortVersionString`, differs from the app's or is missing. The messages are -//! Xcode's, on stderr, where Swift Build reads them. +//! Checks the embedded bundle's identifier and versions against its host. +//! A device App Clip must also name its host in its signed entitlements. use std::path::{Path, PathBuf}; use std::process::ExitCode; use sweetpad_lib::derived_data::plist_strings; +use crate::cli::codesign::{provisioning::check_clip_parent, resign::signed_entitlements}; +use crate::cli::property_list as plist; + pub(super) fn main(args: &[String]) -> ExitCode { match validate(args) { Ok(warnings) => { @@ -36,7 +36,6 @@ fn validate(args: &[String]) -> Result, String> { while let Some(arg) = it.next() { match arg.as_str() { "-info-plist-path" => host_plist = Some(PathBuf::from(super::value(arg, &mut it)?)), - // Nothing is signed during the build here. "-signing-cert" => { super::value(arg, &mut it)?; } @@ -54,7 +53,19 @@ fn validate(args: &[String]) -> Result, String> { )); } let own = plist_strings(&info_plist(&embedded)); - Ok(check(&own, &host)?.into_iter().collect()) + let warning = check(&own, &host)?; + if embedded + .parent() + .is_some_and(|dir| dir.ends_with("AppClips")) + && own + .iter() + .any(|(k, v)| k == "DTPlatformName" && v == "iphoneos") + && let Some(app) = host_plist.parent() + && let Some(host_id) = plist::string(&signed_entitlements(app)?, "application-identifier") + { + check_clip_parent(&signed_entitlements(&embedded)?, host_id)?; + } + Ok(warning.into_iter().collect()) } /// A bundle's Info.plist: at its root on iOS, in `Contents` on macOS. diff --git a/sweetpad-docs/docs/cli/linux/reference.md b/sweetpad-docs/docs/cli/linux/reference.md index a78ab349..43b1824a 100644 --- a/sweetpad-docs/docs/cli/linux/reference.md +++ b/sweetpad-docs/docs/cli/linux/reference.md @@ -8,7 +8,7 @@ sidebar_label: Support and configuration | Operation | On Linux | | --- | --- | -| Build iOS apps, extensions, and widgets | Supported. | +| Build iOS apps, extensions, widgets, and App Clips | Supported. App Clips embed in their host and can be exported in a development-signed IPA. | | Build macOS apps | Supported. Running them needs a Mac. | | Build tvOS, watchOS, and visionOS simulator targets | Builds and links. Running them and device signing are untested. | | Build Mac Catalyst targets | Untested. | diff --git a/sweetpad-lib/ci/check-app-clip.py b/sweetpad-lib/ci/check-app-clip.py new file mode 100644 index 00000000..7f74b7ac --- /dev/null +++ b/sweetpad-lib/ci/check-app-clip.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python3 +"""Compare the delivery fixture's prebuilt App Clip products on a Mac with Xcode.""" +import argparse +import hashlib +import json +import os +from pathlib import Path +import plistlib +import subprocess +import tempfile + + +FIXTURE = Path(__file__).resolve().parent / "fixture-delivery" +PARENT = "com.apple.developer.parent-application-identifiers" +CLIPS = "com.apple.developer.associated-appclip-app-identifiers" +ON_DEMAND = "com.apple.developer.on-demand-install-capable" + + +def run(*command, timeout=240): + result = subprocess.run(command, capture_output=True, timeout=timeout) + if result.returncode: + raise RuntimeError(f"{command[0]} failed: {(result.stderr + result.stdout).decode(errors='replace')}") + return result.stdout + + +def equal(what, actual, expected): + if actual != expected: + raise ValueError(f"{what}: expected {expected!r}, got {actual!r}") + + +def inspect(app, simulator): + clip = app / "AppClips/DeliveryClip.app" + equal("embedded Clips", list(clip.parent.glob("*.app")), [clip]) + metadata, rights = {}, {} + for role, bundle in [("host", app), ("clip", clip)]: + run("codesign", "--verify", "--deep", "--strict", bundle) + info = plistlib.loads((bundle / "Info.plist").read_bytes()) + metadata[role] = {key: info[key] for key in ( + "CFBundleIdentifier", "CFBundleExecutable", "CFBundleVersion", + "CFBundleShortVersionString", "MinimumOSVersion", "UIDeviceFamily", "DTPlatformName")} + equal(f"{role} platform", info["DTPlatformName"], "iphonesimulator" if simulator else "iphoneos") + if role == "clip": + metadata[role]["NSAppClip"] = info["NSAppClip"] + if simulator: + # Simulator entitlements live in the Mach-O, outside the ad hoc signature. + with tempfile.TemporaryDirectory() as temp: + output = Path(temp) / "simulated.plist" + run("xcrun", "segedit", bundle / info["CFBundleExecutable"], + "-extract", "__TEXT", "__entitlements", output) + rights[role] = plistlib.loads(output.read_bytes().rstrip(b"\0")) + else: + rights[role] = plistlib.loads(run("codesign", "-d", "--entitlements", "-", "--xml", bundle)) + profile = plistlib.loads(run("security", "cms", "-D", "-i", bundle / "embedded.mobileprovision")) + with tempfile.TemporaryDirectory() as temp: + run("codesign", "-d", f"--extract-certificates={temp}/signer", bundle) + signer = (Path(temp) / "signer0").read_bytes() + if signer not in profile["DeveloperCertificates"]: + raise ValueError(f"{role} signing certificate is missing from its profile") + association = (CLIPS,) if role == "host" else (PARENT, ON_DEMAND) + for key in ("application-identifier", "get-task-allow", *association): + equal(f"{role} signed/profile {key}", rights[role][key], profile["Entitlements"][key]) + equal(f"{role} development signature", rights[role]["get-task-allow"], True) + + equal("Clip bundle ID", metadata["clip"]["CFBundleIdentifier"], metadata["host"]["CFBundleIdentifier"] + ".Clip") + equal("Clip parent", rights["clip"][PARENT], [rights["host"]["application-identifier"]]) + equal("on-demand capability", rights["clip"][ON_DEMAND], True) + if not simulator: + equal("host association", rights["host"][CLIPS], [rights["clip"]["application-identifier"]]) + return {"info": metadata, "entitlements": rights} + + +def binary_hashes(app): + info = plistlib.loads((app / "Info.plist").read_bytes()) + executable = app / info["CFBundleExecutable"] + binaries = [executable] + # When Xcode emits a debug launcher, the Swift code lives in this dylib. + debug_dylib = app / (executable.name + ".debug.dylib") + if debug_dylib.is_file(): + binaries.append(debug_dylib) + return {binary.name: hashlib.sha256(binary.read_bytes()).hexdigest() for binary in binaries} + + +def install_on_simulator(udid, bundle): + # CoreSimulator's install service cannot read some Linux VM mounts. + with tempfile.TemporaryDirectory() as temp: + local = Path(temp) / bundle.name + run("ditto", bundle, local) + run("xcrun", "simctl", "install", udid, local) + + +def simulator_check(args): + reference = inspect(args.xcode, True) + equal("Linux simulator product", inspect(args.linux, True), reference) + host_id = reference["info"]["host"]["CFBundleIdentifier"] + equal("UI test fixture identifier", host_id, "dev.example.delivery") + clip_id = reference["info"]["clip"]["CFBundleIdentifier"] + simctl = ("xcrun", "simctl") + report = {} + for label, app in [("xcode", args.xcode), ("linux", args.linux)]: + install_on_simulator(args.simulator, app) + try: + run(*simctl, "launch", args.simulator, host_id) + finally: + run(*simctl, "uninstall", args.simulator, host_id) + clip = app / "AppClips/DeliveryClip.app" + install_on_simulator(args.simulator, clip) + try: + result = args.out / f"{label}.xcresult" + test = json.loads(run(args.sweetpad, "test", "--project", FIXTURE / "Delivery.xcodeproj", + "--scheme", "DeliveryClipInvocation", "--destination", + f"platform=iOS Simulator,id={args.simulator}", "--result-bundle", result, + "--non-interactive", "-o", "json", "--", "-parallel-testing-enabled", "NO", + "-derivedDataPath", args.out / "runner", timeout=600)) + equal(f"{label} UI test", (test["ok"], test["data"]["passed"], test["data"]["passedTests"]), + (True, True, 1)) + installed = Path(os.fsdecode(run(*simctl, "get_app_container", args.simulator, clip_id, "app")).strip()) + digests = binary_hashes(installed) + equal(f"{label} installed Clip binaries", digests, binary_hashes(clip)) + report[label] = {"host": str(app.resolve()), "clipSHA256": digests, + "passedTests": test["data"]["passedTests"], "invocationTest": str(result)} + finally: + run(*simctl, "uninstall", args.simulator, clip_id) + return report + + +def archive_app(archive): + info = plistlib.loads((archive / "Info.plist").read_bytes()) + return archive / "Products" / info["ApplicationProperties"]["ApplicationPath"] + + +def uuids(binary): + output = run("xcrun", "dwarfdump", "--uuid", binary) + result = {tuple(line.split()[1:3]) for line in output.splitlines() if line.startswith(b"UUID: ")} + if not result: + raise ValueError(f"{binary} has no UUID") + return result + + +def distribution_check(args): + native = archive_app(args.xcode) + linux = archive_app(args.linux) + reference = inspect(native, False) + equal("Linux archive", inspect(linux, False), reference) + for archive, app in [(args.xcode, native), (args.linux, linux)]: + for bundle in (app, app / "AppClips/DeliveryClip.app"): + binary = plistlib.loads((bundle / "Info.plist").read_bytes())["CFBundleExecutable"] + dsym = archive / "dSYMs" / (bundle.name + ".dSYM") / "Contents/Resources/DWARF" / binary + equal(f"{dsym} UUIDs", uuids(dsym), uuids(bundle / binary)) + with tempfile.TemporaryDirectory() as temp: + run("ditto", "-x", "-k", args.ipa, temp) + exported = inspect(Path(temp) / "Payload" / linux.name, False) + equal("Linux development IPA", exported, reference) + return {"xcodeArchive": str(args.xcode.resolve()), "linuxArchive": str(args.linux.resolve()), + "ipa": str(args.ipa.resolve()), **reference} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + modes = parser.add_subparsers(dest="mode", required=True) + sim = modes.add_parser("simulator", help="install each product on a dedicated booted iPhone and exercise its Clip") + sim.add_argument("--simulator", required=True, help="dedicated iPhone simulator UDID") + sim.add_argument("--sweetpad", default="sweetpad", help="macOS SweetPad CLI") + dist = modes.add_parser("distribution", help="verify development-signed device archives and a debugging IPA") + dist.add_argument("--ipa", type=Path, required=True) + for sub in (sim, dist): + sub.add_argument("--xcode", type=Path, required=True, help="Xcode-built host .app or .xcarchive") + sub.add_argument("--linux", type=Path, required=True, help="Linux-built host .app or .xcarchive") + sub.add_argument("--out", type=Path, required=True, help="new directory for results") + args = parser.parse_args() + args.out = args.out.resolve() + args.out.mkdir(parents=True, exist_ok=False) + report = simulator_check(args) if args.mode == "simulator" else distribution_check(args) + (args.out / "report.json").write_text(json.dumps(report, indent=2) + "\n") + print(f"{args.mode} passed: {args.out / 'report.json'}") + + +if __name__ == "__main__": + main() diff --git a/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/project.pbxproj b/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/project.pbxproj index 373e216e..c6117453 100644 --- a/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/project.pbxproj +++ b/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 1767D6861271A76B6A685D67 /* DeliveryApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE2857443B0F2678AE8E2E6B /* DeliveryApp.swift */; }; 18C3B4B68C4C7D49A656C636 /* DeliveryWidget.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D6DB43B64FE333E4423ACF10 /* DeliveryWidget.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 28C8A9B24024AA01EC1CDF56 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 787770103BFE1EEC0AA281B9 /* Assets.xcassets */; }; + 2D7E245A315DDE12EEA0B7A6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 787770103BFE1EEC0AA281B9 /* Assets.xcassets */; }; 2F0659BA97AEEEBAB7F5C789 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 787770103BFE1EEC0AA281B9 /* Assets.xcassets */; }; 2F920C745BA412A0F4BB88A6 /* DeliveryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C1745C2A8762C8B9CEB4608 /* DeliveryWidget.swift */; }; 4094B33B25AE89A0F9757B40 /* DeliveryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BB7D8BE893070FB3A27298D /* DeliveryKit.framework */; }; @@ -20,13 +21,18 @@ 4E148B05AA156DC2E01D5BC8 /* DeliveryKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2BB7D8BE893070FB3A27298D /* DeliveryKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4EBB519487E625CF30EF27AE /* DeliveryKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3F738A7B82970DE911D9B1 /* DeliveryKit.swift */; }; 51055E2CE488DC2FE207355C /* DeliveryApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE2857443B0F2678AE8E2E6B /* DeliveryApp.swift */; }; + 5CD49DD94BDFF656F7C7DF31 /* DeliveryClip.app in Embed App Clips */ = {isa = PBXBuildFile; fileRef = B145D1CDAFEBF029DFF75E31 /* DeliveryClip.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 5D76E5D70A6BB0C40D615233 /* DeliveryClipInvocationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC607C42011920F61BB35F5A /* DeliveryClipInvocationTests.swift */; }; 61D1F00500B2972D9A98135E /* Stickers.xcstickers in Resources */ = {isa = PBXBuildFile; fileRef = 9D33BFE8597B90CB36E4C97C /* Stickers.xcstickers */; }; 7F95D6040E32E6B70F1374E6 /* DeliveryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C1745C2A8762C8B9CEB4608 /* DeliveryWidget.swift */; }; 8A1EF9D22F9303B250D0D749 /* DeliveryKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B66A42A93FB081CD43CD1B60 /* DeliveryKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 8D39D4D04B38808627D960BC /* DeliveryWatch.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 5979151531102AEB88B7E8F6 /* DeliveryWatch.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + A4162E428FDBCEA3F0023984 /* DeliveryClipApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF5AF1040C832FE730AE8C7 /* DeliveryClipApp.swift */; }; B76280CEC8B62D45615F35A0 /* DeliveryWatchExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = AF48D7A1CAEC2F21D8A38498 /* DeliveryWatchExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + BFD831851B8A12D17915EF27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 787770103BFE1EEC0AA281B9 /* Assets.xcassets */; }; C7EF64F40FDDEE294F27BD85 /* DeliveryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B66A42A93FB081CD43CD1B60 /* DeliveryKit.framework */; }; E561AFCF774A6AB4057C2100 /* DeliveryStickers.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D1287DA92E32BB492EB4CB25 /* DeliveryStickers.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + FAD9FE1625C7E81AB3D33C84 /* DeliveryClipApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF5AF1040C832FE730AE8C7 /* DeliveryClipApp.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -37,6 +43,13 @@ remoteGlobalIDString = EAC9D63AA5CE8D3638F64DBC; remoteInfo = "DeliveryKit-macOS"; }; + 08F1056EC823BCF23D0346EB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 21C744D40939B74039A1F09A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 803F0E1FDD05666ADCEA3BB6; + remoteInfo = DeliveryClip; + }; 18953895144B34320B1DA4EA /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 21C744D40939B74039A1F09A /* Project object */; @@ -82,6 +95,17 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 0CA75BE903753F11072AD79F /* Embed App Clips */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(CONTENTS_FOLDER_PATH)/AppClips"; + dstSubfolderSpec = 16; + files = ( + 5CD49DD94BDFF656F7C7DF31 /* DeliveryClip.app in Embed App Clips */, + ); + name = "Embed App Clips"; + runOnlyForDeploymentPostprocessing = 0; + }; 0D2F3ED49B89AA2BCB0E3546 /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -152,15 +176,20 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0CF5AF1040C832FE730AE8C7 /* DeliveryClipApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeliveryClipApp.swift; sourceTree = ""; }; 1C1745C2A8762C8B9CEB4608 /* DeliveryWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeliveryWidget.swift; sourceTree = ""; }; 2BB7D8BE893070FB3A27298D /* DeliveryKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DeliveryKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 370D888A79CF5A5B88E95C16 /* DeliveryWidget.appex */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.app-extension"; path = DeliveryWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 4C94C267C58152EE05CC1460 /* Delivery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Delivery.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5979151531102AEB88B7E8F6 /* DeliveryWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeliveryWatch.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 621B1EE5B559BF2721CF7B6B /* DeliveryClipHost.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = DeliveryClipHost.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 72DB0E592997B54DF54148EF /* DeliveryClipInvocationTests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = DeliveryClipInvocationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 787770103BFE1EEC0AA281B9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 9D33BFE8597B90CB36E4C97C /* Stickers.xcstickers */ = {isa = PBXFileReference; lastKnownFileType = folder.stickers; path = Stickers.xcstickers; sourceTree = ""; }; A9ECB32CE271D35448EFAD50 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = ""; }; + AC607C42011920F61BB35F5A /* DeliveryClipInvocationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeliveryClipInvocationTests.swift; sourceTree = ""; }; AF48D7A1CAEC2F21D8A38498 /* DeliveryWatchExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = DeliveryWatchExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + B145D1CDAFEBF029DFF75E31 /* DeliveryClip.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = DeliveryClip.app; sourceTree = BUILT_PRODUCTS_DIR; }; B66A42A93FB081CD43CD1B60 /* DeliveryKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DeliveryKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D1287DA92E32BB492EB4CB25 /* DeliveryStickers.appex */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.app-extension"; path = DeliveryStickers.appex; sourceTree = BUILT_PRODUCTS_DIR; }; D6DB43B64FE333E4423ACF10 /* DeliveryWidget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = DeliveryWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -190,11 +219,23 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 46E4A25F660D78537974EE8B /* ClipInvocation */ = { + isa = PBXGroup; + children = ( + AC607C42011920F61BB35F5A /* DeliveryClipInvocationTests.swift */, + ); + name = ClipInvocation; + path = Tests/ClipInvocation; + sourceTree = ""; + }; 4859C233927CBB8905C82A51 /* Products */ = { isa = PBXGroup; children = ( FA2EEE2E34BA921D8564E63F /* Delivery.app */, 4C94C267C58152EE05CC1460 /* Delivery.app */, + B145D1CDAFEBF029DFF75E31 /* DeliveryClip.app */, + 621B1EE5B559BF2721CF7B6B /* DeliveryClipHost.app */, + 72DB0E592997B54DF54148EF /* DeliveryClipInvocationTests.xctest */, B66A42A93FB081CD43CD1B60 /* DeliveryKit.framework */, 2BB7D8BE893070FB3A27298D /* DeliveryKit.framework */, D1287DA92E32BB492EB4CB25 /* DeliveryStickers.appex */, @@ -228,6 +269,8 @@ isa = PBXGroup; children = ( 49C8DB629548C0D1F3BDBBB1 /* App */, + F4A6C818BF3EABA544DE4601 /* ClipFixture */, + 46E4A25F660D78537974EE8B /* ClipInvocation */, DDC3C12180570BD72A98D13B /* Kit */, EEA065C54EEC82625DF72944 /* Resources */, EB1C413333764B1A1EEA4B61 /* Stickers */, @@ -282,6 +325,15 @@ path = Resources; sourceTree = ""; }; + F4A6C818BF3EABA544DE4601 /* ClipFixture */ = { + isa = PBXGroup; + children = ( + 0CF5AF1040C832FE730AE8C7 /* DeliveryClipApp.swift */, + ); + name = ClipFixture; + path = Sources/ClipFixture; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -319,6 +371,24 @@ productReference = B66A42A93FB081CD43CD1B60 /* DeliveryKit.framework */; productType = "com.apple.product-type.framework"; }; + 803F0E1FDD05666ADCEA3BB6 /* DeliveryClip */ = { + isa = PBXNativeTarget; + buildConfigurationList = 04D59661A733011211AE683A /* Build configuration list for PBXNativeTarget "DeliveryClip" */; + buildPhases = ( + AE3C234C498D9FBD13796A48 /* Sources */, + 3E43656309D676623CB95044 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DeliveryClip; + packageProductDependencies = ( + ); + productName = DeliveryClip; + productReference = B145D1CDAFEBF029DFF75E31 /* DeliveryClip.app */; + productType = "com.apple.product-type.application.on-demand-install-capable"; + }; 8BF3C697D7985E242B8733E1 /* DeliveryWidget-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = 424406539D529365FB51046B /* Build configuration list for PBXNativeTarget "DeliveryWidget-iOS" */; @@ -336,6 +406,26 @@ productReference = 370D888A79CF5A5B88E95C16 /* DeliveryWidget.appex */; productType = "com.apple.product-type.app-extension"; }; + 8EB084D969CD05F5628341EC /* DeliveryClipHost */ = { + isa = PBXNativeTarget; + buildConfigurationList = 259D9A1C4145AFAC9A94494F /* Build configuration list for PBXNativeTarget "DeliveryClipHost" */; + buildPhases = ( + D55AEE97C6C5EC14554CE718 /* Sources */, + 3DD4A25E032535B3CE013AA4 /* Resources */, + 0CA75BE903753F11072AD79F /* Embed App Clips */, + ); + buildRules = ( + ); + dependencies = ( + 3BE3672DF3283C608DAEFD8D /* PBXTargetDependency */, + ); + name = DeliveryClipHost; + packageProductDependencies = ( + ); + productName = DeliveryClipHost; + productReference = 621B1EE5B559BF2721CF7B6B /* DeliveryClipHost.app */; + productType = "com.apple.product-type.application"; + }; 937F393F995B70C60EAF5B3C /* Delivery-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = 065A80F0DC9F4049860DD29B /* Build configuration list for PBXNativeTarget "Delivery-iOS" */; @@ -438,6 +528,23 @@ productReference = D1287DA92E32BB492EB4CB25 /* DeliveryStickers.appex */; productType = "com.apple.product-type.app-extension.messages-sticker-pack"; }; + E93FFF218BCFC59C5FA29BB9 /* DeliveryClipInvocationTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E2102B60039A5EAC59357CFF /* Build configuration list for PBXNativeTarget "DeliveryClipInvocationTests" */; + buildPhases = ( + 843D3CA180DDAD7C00C4DDA0 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DeliveryClipInvocationTests; + packageProductDependencies = ( + ); + productName = DeliveryClipInvocationTests; + productReference = 72DB0E592997B54DF54148EF /* DeliveryClipInvocationTests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; EAC9D63AA5CE8D3638F64DBC /* DeliveryKit-macOS */ = { isa = PBXNativeTarget; buildConfigurationList = 785C5098391161FBC5E76172 /* Build configuration list for PBXNativeTarget "DeliveryKit-macOS" */; @@ -470,9 +577,15 @@ 4FE0DC1FB6E3AE5CDB3CBE9E = { ProvisioningStyle = Automatic; }; + 803F0E1FDD05666ADCEA3BB6 = { + ProvisioningStyle = Automatic; + }; 8BF3C697D7985E242B8733E1 = { ProvisioningStyle = Automatic; }; + 8EB084D969CD05F5628341EC = { + ProvisioningStyle = Automatic; + }; 937F393F995B70C60EAF5B3C = { ProvisioningStyle = Automatic; }; @@ -488,6 +601,9 @@ D1D83178C493CAC47045CC40 = { ProvisioningStyle = Automatic; }; + E93FFF218BCFC59C5FA29BB9 = { + ProvisioningStyle = Automatic; + }; EAC9D63AA5CE8D3638F64DBC = { ProvisioningStyle = Automatic; }; @@ -507,6 +623,9 @@ projectDirPath = ""; projectRoot = ""; targets = ( + E93FFF218BCFC59C5FA29BB9 /* DeliveryClipInvocationTests */, + 8EB084D969CD05F5628341EC /* DeliveryClipHost */, + 803F0E1FDD05666ADCEA3BB6 /* DeliveryClip */, 4FE0DC1FB6E3AE5CDB3CBE9E /* DeliveryKit-iOS */, EAC9D63AA5CE8D3638F64DBC /* DeliveryKit-macOS */, 8BF3C697D7985E242B8733E1 /* DeliveryWidget-iOS */, @@ -537,6 +656,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 3DD4A25E032535B3CE013AA4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D7E245A315DDE12EEA0B7A6 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3E43656309D676623CB95044 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BFD831851B8A12D17915EF27 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4B8DCE41491C65F627F6E14B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -580,6 +715,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 843D3CA180DDAD7C00C4DDA0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5D76E5D70A6BB0C40D615233 /* DeliveryClipInvocationTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + AE3C234C498D9FBD13796A48 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A4162E428FDBCEA3F0023984 /* DeliveryClipApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B8C806074034D6BA28504C7C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -612,6 +763,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D55AEE97C6C5EC14554CE718 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FAD9FE1625C7E81AB3D33C84 /* DeliveryClipApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -625,6 +784,11 @@ target = 8BF3C697D7985E242B8733E1 /* DeliveryWidget-iOS */; targetProxy = 7414B35F4CE4BC0F3A6DE905 /* PBXContainerItemProxy */; }; + 3BE3672DF3283C608DAEFD8D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 803F0E1FDD05666ADCEA3BB6 /* DeliveryClip */; + targetProxy = 08F1056EC823BCF23D0346EB /* PBXContainerItemProxy */; + }; 490411BF201BDB675C049C3C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9CC855047213D10A9BA7B370 /* DeliveryWatch */; @@ -862,6 +1026,62 @@ }; name = Debug; }; + 708C23400A4FFE3F74D4028D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = "Delivery Host"; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(DELIVERY_BUNDLE_ID)"; + PROVISIONING_PROFILE_SPECIFIER = "$(DELIVERY_APP_PROFILE)"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 75218BDF84A8E8FC07ECD663 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "dev.sweetpad.tests.clip-invocation"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7DE3B05495A96EB81C7EBD52 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "dev.sweetpad.tests.clip-invocation"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 86041C76859B2173807FB723 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -883,6 +1103,30 @@ }; name = Debug; }; + 86C4C33113E35491D17A9E10 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Entitlements/Clip-iOS.entitlements"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Supporting/Clip-Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Delivery Clip"; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(DELIVERY_BUNDLE_ID).Clip"; + PROVISIONING_PROFILE_SPECIFIER = "$(DELIVERY_CLIP_PROFILE)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 9FD49DC2F77C2B8C20608370 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -933,6 +1177,28 @@ }; name = Debug; }; + B7FBBE082DCFC30E53C29941 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = "Delivery Host"; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(DELIVERY_BUNDLE_ID)"; + PROVISIONING_PROFILE_SPECIFIER = "$(DELIVERY_APP_PROFILE)"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; C2522E4E85918F618D3905AA /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1081,6 +1347,30 @@ }; name = Debug; }; + DCC4E3183994D4CBF05E1333 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Entitlements/Clip-iOS.entitlements"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Supporting/Clip-Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Delivery Clip"; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "$(DELIVERY_BUNDLE_ID).Clip"; + PROVISIONING_PROFILE_SPECIFIER = "$(DELIVERY_CLIP_PROFILE)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; E54426CF4C2105D811BDDF00 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1171,6 +1461,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 04D59661A733011211AE683A /* Build configuration list for PBXNativeTarget "DeliveryClip" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DCC4E3183994D4CBF05E1333 /* Debug */, + 86C4C33113E35491D17A9E10 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 065A80F0DC9F4049860DD29B /* Build configuration list for PBXNativeTarget "Delivery-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1180,6 +1479,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + 259D9A1C4145AFAC9A94494F /* Build configuration list for PBXNativeTarget "DeliveryClipHost" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 708C23400A4FFE3F74D4028D /* Debug */, + B7FBBE082DCFC30E53C29941 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; 424406539D529365FB51046B /* Build configuration list for PBXNativeTarget "DeliveryWidget-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1261,6 +1569,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + E2102B60039A5EAC59357CFF /* Build configuration list for PBXNativeTarget "DeliveryClipInvocationTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 75218BDF84A8E8FC07ECD663 /* Debug */, + 7DE3B05495A96EB81C7EBD52 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; /* End XCConfigurationList section */ }; rootObject = 21C744D40939B74039A1F09A /* Project object */; diff --git a/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/xcshareddata/xcschemes/DeliveryClipHost.xcscheme b/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/xcshareddata/xcschemes/DeliveryClipHost.xcscheme new file mode 100644 index 00000000..c2433114 --- /dev/null +++ b/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/xcshareddata/xcschemes/DeliveryClipHost.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/xcshareddata/xcschemes/DeliveryClipInvocation.xcscheme b/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/xcshareddata/xcschemes/DeliveryClipInvocation.xcscheme new file mode 100644 index 00000000..111d7110 --- /dev/null +++ b/sweetpad-lib/ci/fixture-delivery/Delivery.xcodeproj/xcshareddata/xcschemes/DeliveryClipInvocation.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sweetpad-lib/ci/fixture-delivery/Entitlements/Clip-iOS.entitlements b/sweetpad-lib/ci/fixture-delivery/Entitlements/Clip-iOS.entitlements new file mode 100644 index 00000000..2bf973eb --- /dev/null +++ b/sweetpad-lib/ci/fixture-delivery/Entitlements/Clip-iOS.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.developer.parent-application-identifiers + + $(AppIdentifierPrefix)$(DELIVERY_BUNDLE_ID) + + + diff --git a/sweetpad-lib/ci/fixture-delivery/README.md b/sweetpad-lib/ci/fixture-delivery/README.md index 08688d0b..39f31708 100644 --- a/sweetpad-lib/ci/fixture-delivery/README.md +++ b/sweetpad-lib/ci/fixture-delivery/README.md @@ -26,6 +26,7 @@ from build-setting overrides: | `DELIVERY_APS_ENVIRONMENT` | `development`, or `production` for a distribution archive. | | `CODE_SIGN_STYLE`, `CODE_SIGN_IDENTITY` | `Manual` and the identity, to sign as a particular method. | | `DELIVERY_APP_PROFILE`, `DELIVERY_WIDGET_PROFILE` | The profile names for manual signing. | +| `DELIVERY_CLIP_PROFILE` | The development profile for `.Clip` when signing the App Clip manually. Its host uses `DELIVERY_APP_PROFILE`. | | `DELIVERY_WATCH_PROFILE`, `DELIVERY_WATCH_EXTENSION_PROFILE`, `DELIVERY_STICKERS_PROFILE` | The same for the iOS app's watch app, its extension and the sticker pack. | | `CURRENT_PROJECT_VERSION` | A new build number for each upload. | @@ -50,3 +51,58 @@ sweetpad archive --project Delivery.xcodeproj --scheme Delivery-macOS \ `sweetpad-cli/PLAN_LINUX.md` records which exports, uploads and notarizations were checked against Apple, and how. + +## App Clips + +The `DeliveryClipHost` scheme builds a host with `AppClips/DeliveryClip.app`. +The Clip displays the HTTPS URL it receives. Run the following commands from this +directory. Use a dedicated booted iPhone simulator on an Apple silicon Mac. + +On the Mac, set `ENGINE=xcodebuild` and `DEST="platform=iOS Simulator,id=$SIMULATOR_UDID"`. +On Linux, set `ENGINE=swift-build` and `DEST="generic/platform=iOS Simulator,arch=arm64"`. +Build once on each machine using the fixture's default bundle IDs and the same +test team so their simulator entitlements can be compared. + +```bash +sweetpad build --engine "$ENGINE" --project Delivery.xcodeproj --scheme DeliveryClipHost \ + --configuration Debug --destination "$DEST" -- \ + -derivedDataPath "$PWD/build/$ENGINE-sim" DEVELOPMENT_TEAM=CLIPTEST01 +``` + +Make both host apps available on the Mac and set `XCODE_SIM_APP` and +`LINUX_SIM_APP` to their paths. The checker installs and launches each host, +removes it, then installs its embedded Clip on its own. A standalone UI test +opens a fresh URL in the installed Clip and reads it back from the screen. +The checker verifies the installed binaries against the originals and saves +both XCTest result bundles. + +```bash +python3 ../check-app-clip.py simulator --simulator "$SIMULATOR_UDID" \ + --xcode "$XCODE_SIM_APP" --linux "$LINUX_SIM_APP" --out build/clip-invocation +``` + +For a device archive, use an Apple Development identity and development profiles +for the registered host and Clip. The host profile must name the Clip, and the +Clip profile must grant on-demand installation and name the host. Configure the +Linux signing environment as described in [the Linux reference](../../../sweetpad-docs/docs/cli/linux/reference.md#environment-variables). +The following command produces the Linux archive and IPA. On the Mac, change +`--export-method debugging` to `--no-export` to build the reference archive. + +```bash +sweetpad archive --engine "$ENGINE" --project Delivery.xcodeproj --scheme DeliveryClipHost \ + --configuration Release --destination generic/platform=iOS --output-file "$PWD/build/$ENGINE-device" \ + --export-method debugging -- DEVELOPMENT_TEAM="$TEAM_ID" DELIVERY_BUNDLE_ID="$BUNDLE_ID" +``` + +On the Mac, point the checker at the two archives and the Linux IPA. It compares +the bundle metadata and signed entitlements, verifies each signature against its +embedded profile, and matches the host and Clip dSYMs to their executables. + +```bash +python3 ../check-app-clip.py distribution --xcode "$XCODE_ARCHIVE" \ + --linux "$LINUX_ARCHIVE" --ipa "$LINUX_IPA" --out build/clip-signatures +``` + +To exercise the failure case, append `CODE_SIGN_ENTITLEMENTS=` after `--` on a +signed archive build. Both engines must fail and name the missing +`com.apple.developer.parent-application-identifiers` entitlement. diff --git a/sweetpad-lib/ci/fixture-delivery/Sources/ClipFixture/DeliveryClipApp.swift b/sweetpad-lib/ci/fixture-delivery/Sources/ClipFixture/DeliveryClipApp.swift new file mode 100644 index 00000000..97ae1255 --- /dev/null +++ b/sweetpad-lib/ci/fixture-delivery/Sources/ClipFixture/DeliveryClipApp.swift @@ -0,0 +1,19 @@ +import SwiftUI + +@main +struct DeliveryClipApp: App { + @State private var invocation = "" + + var body: some Scene { + WindowGroup { + VStack { + Text(Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? "Delivery") + Text(invocation) + } + .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { activity in + if let url = activity.webpageURL { invocation = url.absoluteString } + } + .onOpenURL { url in invocation = url.absoluteString } + } + } +} diff --git a/sweetpad-lib/ci/fixture-delivery/Supporting/Clip-Info.plist b/sweetpad-lib/ci/fixture-delivery/Supporting/Clip-Info.plist new file mode 100644 index 00000000..074a6d12 --- /dev/null +++ b/sweetpad-lib/ci/fixture-delivery/Supporting/Clip-Info.plist @@ -0,0 +1,13 @@ + + + + + NSAppClip + + NSAppClipRequestEphemeralUserNotification + + NSAppClipRequestLocationConfirmation + + + + diff --git a/sweetpad-lib/ci/fixture-delivery/Tests/ClipInvocation/DeliveryClipInvocationTests.swift b/sweetpad-lib/ci/fixture-delivery/Tests/ClipInvocation/DeliveryClipInvocationTests.swift new file mode 100644 index 00000000..1f4f86de --- /dev/null +++ b/sweetpad-lib/ci/fixture-delivery/Tests/ClipInvocation/DeliveryClipInvocationTests.swift @@ -0,0 +1,12 @@ +import XCTest + +final class DeliveryClipInvocationTests: XCTestCase { + func testInstalledClipDisplaysInvocationURL() throws { + let clip = XCUIApplication(bundleIdentifier: "dev.example.delivery.Clip") + let url = try XCTUnwrap(URL(string: "https://example.com/delivery/\(UUID().uuidString)")) + clip.launch() + XCTAssertTrue(clip.staticTexts["Delivery Clip"].waitForExistence(timeout: 10)) + clip.open(url) + XCTAssertTrue(clip.staticTexts[url.absoluteString].waitForExistence(timeout: 10)) + } +} diff --git a/sweetpad-lib/ci/fixture-delivery/project.yml b/sweetpad-lib/ci/fixture-delivery/project.yml index c8f6258d..dbb43a37 100644 --- a/sweetpad-lib/ci/fixture-delivery/project.yml +++ b/sweetpad-lib/ci/fixture-delivery/project.yml @@ -9,6 +9,18 @@ settings: DELIVERY_APS_ENVIRONMENT: development CODE_SIGN_STYLE: Automatic targetTemplates: + ClipFixture: + platform: iOS + deploymentTarget: "17.0" + sources: [Sources/ClipFixture, Resources] + settings: + base: + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_UIApplicationSceneManifest_Generation: YES + INFOPLIST_KEY_UILaunchScreen_Generation: YES + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight" + ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon + TARGETED_DEVICE_FAMILY: "1,2" Kit: type: framework productName: DeliveryKit @@ -49,6 +61,37 @@ targetTemplates: SKIP_INSTALL: YES PROVISIONING_PROFILE_SPECIFIER: $(DELIVERY_WIDGET_PROFILE) targets: + DeliveryClipInvocationTests: + type: bundle.ui-testing + platform: iOS + deploymentTarget: "17.0" + sources: [Tests/ClipInvocation] + settings: + base: + PRODUCT_BUNDLE_IDENTIFIER: dev.sweetpad.tests.clip-invocation + GENERATE_INFOPLIST_FILE: YES + DeliveryClipHost: + templates: [ClipFixture] + type: application + scheme: {} + settings: + base: + PRODUCT_BUNDLE_IDENTIFIER: $(DELIVERY_BUNDLE_ID) + INFOPLIST_KEY_CFBundleDisplayName: Delivery Host + PROVISIONING_PROFILE_SPECIFIER: $(DELIVERY_APP_PROFILE) + dependencies: + - target: DeliveryClip + DeliveryClip: + templates: [ClipFixture] + type: application.on-demand-install-capable + settings: + base: + PRODUCT_BUNDLE_IDENTIFIER: $(DELIVERY_BUNDLE_ID).Clip + INFOPLIST_KEY_CFBundleDisplayName: Delivery Clip + INFOPLIST_FILE: Supporting/Clip-Info.plist + CODE_SIGN_ENTITLEMENTS: Entitlements/Clip-iOS.entitlements + PROVISIONING_PROFILE_SPECIFIER: $(DELIVERY_CLIP_PROFILE) + SKIP_INSTALL: YES DeliveryKit-iOS: templates: [Kit] platform: iOS @@ -153,3 +196,10 @@ targets: CODE_SIGN_ENTITLEMENTS: Entitlements/App-macOS.entitlements ENABLE_HARDENED_RUNTIME: YES INFOPLIST_KEY_LSApplicationCategoryType: public.app-category.developer-tools +schemes: + DeliveryClipInvocation: + build: + targets: + DeliveryClipInvocationTests: [test] + test: + targets: [DeliveryClipInvocationTests]