From 78d3f81b427bfe20f7e579716712e0553665dad5 Mon Sep 17 00:00:00 2001 From: ddrccw Date: Fri, 28 Mar 2025 15:11:54 +0800 Subject: [PATCH] feat: add support for internal distribution flag in xcframework creation This commit introduces a new `allowInternalDistribution` flag to the command options, enabling the creation of xcframeworks containing information not suitable for public distribution. The flag is passed to the xcodebuild command when set, ensuring the xcframework is built with the appropriate configuration. Signed-off-by: ddrccw --- Sources/CreateXCFramework/Command+Options.swift | 3 +++ Sources/CreateXCFramework/XcodeBuilder.swift | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Sources/CreateXCFramework/Command+Options.swift b/Sources/CreateXCFramework/Command+Options.swift index d528752..03723f6 100644 --- a/Sources/CreateXCFramework/Command+Options.swift +++ b/Sources/CreateXCFramework/Command+Options.swift @@ -80,6 +80,9 @@ extension Command { @Flag(help: "Skip binary targets for project generation. Useful for creating and distributing a library from one Package.swift") var skipBinaryTargets: Bool = false + @Flag(help: "Specifies that the created xcframework contains information not suitable for public distribution.") + var allowInternalDistribution: Bool = false + // MARK: - Targets @Argument(help: "An optional list of products (or targets) to build. Defaults to building all `.library` products") diff --git a/Sources/CreateXCFramework/XcodeBuilder.swift b/Sources/CreateXCFramework/XcodeBuilder.swift index 9c1de7f..e754600 100644 --- a/Sources/CreateXCFramework/XcodeBuilder.swift +++ b/Sources/CreateXCFramework/XcodeBuilder.swift @@ -306,6 +306,10 @@ struct XcodeBuilder { return args } + if self.package.options.allowInternalDistribution { + command += [ "-allow-internal-distribution" ] + } + // and the output command += [ "-output", outputPath.path ]