Skip to content

Commit 5404ebb

Browse files
authored
feat(apple): improve support for watchos projects (#5993)
1 parent 90fe969 commit 5404ebb

5 files changed

Lines changed: 1418 additions & 62 deletions

File tree

lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ export enum IOSNativeTargetTypes {
409409
watchApp = "watch_app",
410410
watchExtension = "watch_extension",
411411
appExtension = "app_extension",
412+
application = 'application',
412413
}
413414

414415
const pathToLoggerAppendersDir = join(

lib/definitions/nativescript-dev-xcode.d.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,27 @@ declare module "nativescript-dev-xcode" {
88
}
99

1010
class project {
11+
hash: any;
12+
filepath: string;
1113
constructor(filename: string);
1214

1315
parse(callback: () => void): void;
1416
parseSync(): void;
1517

18+
generateUuid(): string;
19+
1620
writeSync(options: any): string;
1721

1822
addFramework(filepath: string, options?: Options): void;
1923
removeFramework(filePath: string, options?: Options): void;
2024

25+
26+
getProductFile(watchApptarget: target): any;
27+
addToPbxFrameworksBuildPhase(file);
28+
addToPbxCopyfilesBuildPhase(file, comment: string, targetid: string);
29+
pbxFrameworksBuildPhaseObj(targetid: string): any;
30+
pbxBuildFileSection(): {[k: string] : any};
31+
2132
addPbxGroup(
2233
filePathsArray: any[],
2334
name: string,
@@ -27,17 +38,30 @@ declare module "nativescript-dev-xcode" {
2738

2839
removePbxGroup(groupName: string, path: string): void;
2940

41+
addTargetDependency(target: string, dependencyTargets: string[]);
42+
43+
findTargetKey(name: string);
44+
pbxTargetByName(name: string): target;
45+
pbxNativeTargetSection(): {[key: string]: any};
46+
3047
addToHeaderSearchPaths(options?: Options): void;
3148
removeFromHeaderSearchPaths(options?: Options): void;
3249
updateBuildProperty(key: string, value: any): void;
3350

3451
pbxXCBuildConfigurationSection(): any;
3552

53+
buildPhaseObject(
54+
buildPhaseType: string,
55+
comment: string,
56+
target: tstring
57+
)
58+
3659
addTarget(
3760
targetName: string,
3861
targetType: string,
3962
targetPath?: string,
40-
parentTarget?: string
63+
parentTarget?: string,
64+
productTargetType?: string
4165
): target;
4266
addBuildPhase(
4367
filePathsArray: string[],

lib/definitions/project.d.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ interface IAddExtensionsFromPathOptions extends IAddTargetFromPathOptions {
880880

881881
interface IAddWatchAppFromPathOptions extends IAddTargetFromPathOptions {
882882
watchAppFolderPath: string;
883+
disableStubBinary?: boolean;
883884
}
884885

885886
interface IRemoveExtensionsOptions {
@@ -888,6 +889,37 @@ interface IRemoveExtensionsOptions {
888889

889890
interface IRemoveWatchAppOptions extends IRemoveExtensionsOptions {}
890891

892+
interface IWatchAppJSONConfigModule {
893+
name?: string;
894+
path: string;
895+
targetType?: string;
896+
embed?: boolean;
897+
frameworks?: Array<string | Record<string, string>>;
898+
dependencies?: string[];
899+
headerSearchPaths?: string[];
900+
resources?: string[];
901+
src?: string[];
902+
linkerFlags?: string[];
903+
buildConfigurationProperties?: Record<string, string>;
904+
SPMPackages?: Array<IOSSPMPackage | string>;
905+
}
906+
interface IWatchAppJSONConfig {
907+
targetType?: string;
908+
forceAddEmbedWatchContent?: boolean;
909+
sharedModulesBuildConfigurationProperties?: Record<string, string>;
910+
basedir?: string;
911+
infoPlistPath?: string;
912+
xcprivacyPath?: string;
913+
importSourcesFromMainFolder?: boolean;
914+
importResourcesFromMainFolder?: boolean;
915+
resources?: string[];
916+
src?: string[];
917+
resourcesExclude?: string[];
918+
srcExclude?: string[];
919+
modules: IWatchAppConfigModule[];
920+
SPMPackages?: Array<IOSSPMPackage>;
921+
}
922+
891923
interface IRubyFunction {
892924
functionName: string;
893925
functionParameters?: string;

lib/services/ios-project-service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ export class IOSProjectService
877877
}
878878
}
879879

880-
this.$iOSWatchAppService.removeWatchApp({ pbxProjPath });
881880
const addedWatchApp = await this.$iOSWatchAppService.addWatchAppFromPath({
882881
watchAppFolderPath: path.join(
883882
resourcesDirectoryPath,

0 commit comments

Comments
 (0)