Skip to content

Commit aa61b07

Browse files
committed
fix: watch target duplicate outputs
1 parent 05f14cf commit aa61b07

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lib/services/ios-watch-app-service.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ export class IOSWatchAppService implements IIOSWatchAppService {
107107
const targetUuids: string[] = [];
108108
const targetNames: string[] = [];
109109
const appPath = path.join(watchAppFolderPath, IOS_WATCHAPP_FOLDER);
110+
const extensionPath = path.join(
111+
watchAppFolderPath,
112+
IOS_WATCHAPP_EXTENSION_FOLDER,
113+
);
114+
const hasWatchExtension = this.$fs.exists(extensionPath);
110115

111116
// Check if watchapp exists - it's required
112117
if (!this.$fs.exists(appPath)) {
@@ -154,16 +159,13 @@ export class IOSWatchAppService implements IIOSWatchAppService {
154159
projectData,
155160
platformData,
156161
pbxProjPath,
162+
!hasWatchExtension,
157163
);
158164
targetUuids.push(watchApptarget.uuid);
159165
targetNames.push(appFolder);
160166

161-
const extensionPath = path.join(
162-
watchAppFolderPath,
163-
IOS_WATCHAPP_EXTENSION_FOLDER,
164-
);
165167
// Extension is optional (Xcode 14+ supports single target)
166-
if (this.$fs.exists(extensionPath)) {
168+
if (hasWatchExtension) {
167169
const extensionFolder =
168170
this.$iOSNativeTargetService.getTargetDirectories(extensionPath)[0];
169171
const configPath = path.join(
@@ -458,6 +460,7 @@ export class IOSWatchAppService implements IIOSWatchAppService {
458460
projectData: IProjectData,
459461
platformData: IPlatformData,
460462
pbxProjPath: string,
463+
disableStubBinary = false,
461464
) {
462465
const identifierParts = identifier.split(".");
463466
identifierParts.pop();
@@ -471,6 +474,13 @@ export class IOSWatchAppService implements IIOSWatchAppService {
471474
{ name: "WATCHOS_DEPLOYMENT_TARGET", value: 5.2 },
472475
{ name: "WK_APP_BUNDLE_IDENTIFIER", value: wkAppBundleIdentifier },
473476
];
477+
478+
if (disableStubBinary) {
479+
buildConfigProperties.push(
480+
{ name: "PRODUCT_BINARY_SOURCE_PATH", value: '""' },
481+
{ name: "PRODUCT_TYPE_HAS_STUB_BINARY", value: "NO" },
482+
);
483+
}
474484
const resourcesGroup = targetName + "Resources";
475485
project.addPbxGroup([], resourcesGroup, project.filepath, null, {
476486
isMain: true,

0 commit comments

Comments
 (0)