From 4b1e1042ccfff5ac2ecae031ede4f2b3aa1b09f4 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 15 Jun 2026 09:59:04 -0700 Subject: [PATCH] feat(apple): support team signing on Swift macro SPM targets --- lib/services/ios/xcodebuild-args-service.ts | 12 ++++++++++++ test/services/ios/xcodebuild-args-service.ts | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/services/ios/xcodebuild-args-service.ts b/lib/services/ios/xcodebuild-args-service.ts index fe0d5de642..9f6998b79c 100644 --- a/lib/services/ios/xcodebuild-args-service.ts +++ b/lib/services/ios/xcodebuild-args-service.ts @@ -227,6 +227,18 @@ export class XcodebuildArgsService implements IXcodebuildArgsService { extraArgs.push(`${swiftUIBootProperty}=${swiftUIBootValue}`); } + // Swift macro/compiler-plugin SPM targets must be code-signed with a + // development team when building for a device. Pass DEVELOPMENT_TEAM as a + // command-line build setting so it applies to SPM package targets too. + const developmentTeamProperty = "DEVELOPMENT_TEAM"; + const developmentTeamValue = this.$xcconfigService.readPropertyValue( + BUILD_SETTINGS_FILE_PATH, + developmentTeamProperty, + ); + if (developmentTeamValue) { + extraArgs.push(`${developmentTeamProperty}=${developmentTeamValue}`); + } + if (this.$fs.exists(xcworkspacePath)) { return ["-workspace", xcworkspacePath, ...extraArgs]; } diff --git a/test/services/ios/xcodebuild-args-service.ts b/test/services/ios/xcodebuild-args-service.ts index d2f7455f7b..29cba1ad6f 100644 --- a/test/services/ios/xcodebuild-args-service.ts +++ b/test/services/ios/xcodebuild-args-service.ts @@ -101,6 +101,24 @@ describe("xcodebuildArgsService", () => { assert.include(actualArgs, "SWIFT_ENABLE_EXPLICIT_MODULES=YES"); assert.notInclude(actualArgs, "SWIFT_ENABLE_EXPLICIT_MODULES=NO"); }); + + it("should include DEVELOPMENT_TEAM from build.xcconfig", () => { + const injector = createTestInjector({ + logLevel: "INFO", + hasProjectWorkspace: false, + buildXcconfigContent: "DEVELOPMENT_TEAM = TEAM123", + }); + const xcodebuildArgsService: IXcodebuildArgsService = injector.resolve( + "xcodebuildArgsService", + ); + + const actualArgs = xcodebuildArgsService.getXcodeProjectArgs( + { projectRoot, normalizedPlatformName }, + { projectName, appResourcesDirectoryPath }, + ); + + assert.include(actualArgs, "DEVELOPMENT_TEAM=TEAM123"); + }); }); describe("getBuildForSimulatorArgs", () => {