Skip to content

Commit ba5edbe

Browse files
committed
chore: cleanup
1 parent 5aa603a commit ba5edbe

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

lib/definitions/ios.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare global {
5757
buildConfig: IBuildConfig
5858
): Promise<string[]>;
5959
getXcodeProjectArgs(
60-
projectRoot: string,
60+
platformData: IPlatformData,
6161
projectData: IProjectData
6262
): string[];
6363
}

lib/services/ios/spm-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class SPMService implements ISPMService {
7878
) {
7979
await this.$xcodebuildCommandService.executeCommand(
8080
this.$xcodebuildArgsService
81-
.getXcodeProjectArgs(platformData.projectRoot, projectData)
81+
.getXcodeProjectArgs(platformData, projectData)
8282
.concat([
8383
"-destination",
8484
"generic/platform=iOS",

lib/services/ios/xcodebuild-args-service.ts

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
5353
)
5454
)
5555
.concat(this.getBuildLoggingArgs())
56-
.concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData));
56+
.concat(this.getXcodeProjectArgs(platformData, projectData));
5757

5858
return args;
5959
}
@@ -78,7 +78,7 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
7878
buildConfig.release ? Configurations.Release : Configurations.Debug,
7979
"-allowProvisioningUpdates",
8080
]
81-
.concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData))
81+
.concat(this.getXcodeProjectArgs(platformData, projectData))
8282
.concat(architectures)
8383
.concat(
8484
this.getBuildCommonArgs(
@@ -108,51 +108,43 @@ export class XcodebuildArgsService implements IXcodebuildArgsService {
108108
}
109109

110110
public getXcodeProjectArgs(
111-
projectRoot: string,
111+
platformData: IPlatformData,
112112
projectData: IProjectData
113113
): string[] {
114114
const xcworkspacePath = path.join(
115-
projectRoot,
115+
platformData.projectRoot,
116116
`${projectData.projectName}.xcworkspace`
117117
);
118118
// Introduced in Xcode 14+
119119
// ref: https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/5
120120
const skipPackageValidation = "-skipPackagePluginValidation";
121121

122-
// TODO:
123-
// 1. make sure file exists
124-
// 2. use ios/visionos based on platform target
122+
const extraArgs: string[] = [
123+
"-scheme",
124+
projectData.projectName,
125+
skipPackageValidation,
126+
];
127+
125128
const BUILD_SETTINGS_FILE_PATH = path.join(
126129
projectData.appResourcesDirectoryPath,
127-
"iOS",
130+
platformData.normalizedPlatformName,
128131
constants.BUILD_XCCONFIG_FILE_NAME
129132
);
130133

134+
if (this.$fs.exists(BUILD_SETTINGS_FILE_PATH)) {
135+
extraArgs.push("-xcconfig");
136+
extraArgs.push(BUILD_SETTINGS_FILE_PATH);
137+
}
138+
131139
if (this.$fs.exists(xcworkspacePath)) {
132-
return [
133-
"-workspace",
134-
xcworkspacePath,
135-
"-scheme",
136-
projectData.projectName,
137-
skipPackageValidation,
138-
"-xcconfig",
139-
BUILD_SETTINGS_FILE_PATH,
140-
];
140+
return ["-workspace", xcworkspacePath, ...extraArgs];
141141
}
142142

143143
const xcodeprojPath = path.join(
144-
projectRoot,
144+
platformData.projectRoot,
145145
`${projectData.projectName}.xcodeproj`
146146
);
147-
return [
148-
"-project",
149-
xcodeprojPath,
150-
"-scheme",
151-
projectData.projectName,
152-
skipPackageValidation,
153-
"-xcconfig",
154-
BUILD_SETTINGS_FILE_PATH,
155-
];
147+
return ["-project", xcodeprojPath, ...extraArgs];
156148
}
157149

158150
private getBuildLoggingArgs(): string[] {

0 commit comments

Comments
 (0)