From 3c7f35ad861495d515fb8821f86c7271aaadd162 Mon Sep 17 00:00:00 2001 From: foyoodo Date: Sun, 15 Dec 2024 00:26:43 +0800 Subject: [PATCH] feat: Add embeddable plugin determination --- Sources/XcodeGraph/Models/Target.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/XcodeGraph/Models/Target.swift b/Sources/XcodeGraph/Models/Target.swift index 2ddd943b..f7ac328d 100644 --- a/Sources/XcodeGraph/Models/Target.swift +++ b/Sources/XcodeGraph/Models/Target.swift @@ -259,6 +259,12 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { product == .xpc } + /// Determines if the target is an embeddable plugin + /// i.e. a product that can be bundled with a host macOS application or a Mac Catalyst application + public func isEmbeddablePlugin() -> Bool { + supports(.macOS) && product == .bundle + } + /// Determines if the target is an embeddable system extension /// i.e. a product that can be bundled with a host macOS application public func isEmbeddableSystemExtension() -> Bool { @@ -277,6 +283,12 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { supports(.macOS) && product == .app } + /// Determines if the target is able to embed a plugin + /// i.e. a product that can be bundled with a macOS application or a Mac Catalyst application + public func canEmbedPlugins() -> Bool { + (supports(.macOS) || supportsCatalyst) && product == .app + } + /// Return the a set of PlatformFilters to control linking based on what platform is being compiled /// This allows a target to link against a dependency conditionally when it is being compiled for a compatible platform /// E.g. An app linking against CarPlay only when built for iOS.