nativescript 9.1.0-alpha.0 → 9.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/config/test-deps-versions-generated.json +3 -3
- package/lib/.d.ts +1 -0
- package/lib/bootstrap.js +0 -2
- package/lib/commands/build.js +1 -30
- package/lib/commands/run.js +1 -39
- package/lib/commands/widget.js +1 -2
- package/lib/common/definitions/mobile.d.ts +0 -3
- package/lib/common/file-system.js +11 -15
- package/lib/common/mobile/device-platforms-constants.js +0 -4
- package/lib/common/mobile/mobile-helper.js +1 -12
- package/lib/constants.js +7 -2
- package/lib/controllers/prepare-controller.js +0 -28
- package/lib/definitions/nativescript-dev-xcode.d.ts +25 -1
- package/lib/definitions/project.d.ts +35 -6
- package/lib/key-commands/bootstrap.js +0 -1
- package/lib/key-commands/index.js +1 -53
- package/lib/project-data.js +0 -6
- package/lib/services/bundler/bundler-compiler-service.js +24 -13
- package/lib/services/debug-service-base.js +1 -1
- package/lib/services/ios/ios-signing-service.js +10 -3
- package/lib/services/ios/spm-service.js +1 -8
- package/lib/services/ios/xcodebuild-args-service.js +10 -29
- package/lib/services/ios-entitlements-service.js +3 -1
- package/lib/services/ios-project-service.js +27 -74
- package/lib/services/ios-watch-app-service.js +663 -16
- package/lib/services/platforms-data-service.js +0 -1
- package/lib/services/plugins-service.js +4 -24
- package/lib/services/project-changes-service.js +4 -15
- package/lib/services/project-data-service.js +2 -20
- package/lib/services/versions-service.js +0 -4
- package/lib/tools/config-manipulation/config-transformer.js +55 -3
- package/package.json +23 -12
package/lib/project-data.js
CHANGED
|
@@ -25,7 +25,6 @@ class ProjectData {
|
|
|
25
25
|
this.projectIdentifiers.ios = identifier;
|
|
26
26
|
this.projectIdentifiers.android = identifier;
|
|
27
27
|
this.projectIdentifiers.visionos = identifier;
|
|
28
|
-
this.projectIdentifiers.macos = identifier;
|
|
29
28
|
}
|
|
30
29
|
constructor($fs, $errors, $projectHelper, $staticConfig, $options, $logger, $injector, $androidResourcesMigrationService, $devicePlatformsConstants) {
|
|
31
30
|
this.$fs = $fs;
|
|
@@ -176,14 +175,12 @@ class ProjectData {
|
|
|
176
175
|
ios: "",
|
|
177
176
|
android: "",
|
|
178
177
|
visionos: "",
|
|
179
|
-
macos: "",
|
|
180
178
|
};
|
|
181
179
|
}
|
|
182
180
|
const identifier = {
|
|
183
181
|
ios: config.id,
|
|
184
182
|
android: config.id,
|
|
185
183
|
visionos: config.id,
|
|
186
|
-
macos: config.id,
|
|
187
184
|
};
|
|
188
185
|
if (config.ios && config.ios.id) {
|
|
189
186
|
identifier.ios = config.ios.id;
|
|
@@ -194,9 +191,6 @@ class ProjectData {
|
|
|
194
191
|
if (config.visionos && config.visionos.id) {
|
|
195
192
|
identifier.visionos = config.visionos.id;
|
|
196
193
|
}
|
|
197
|
-
if (config.macos && config.macos.id) {
|
|
198
|
-
identifier.macos = config.macos.id;
|
|
199
|
-
}
|
|
200
194
|
return identifier;
|
|
201
195
|
}
|
|
202
196
|
getProjectType() {
|
|
@@ -67,7 +67,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
67
67
|
console.log("Received Vite IPC message:", message);
|
|
68
68
|
}
|
|
69
69
|
// Copy Vite output files directly to platform destination
|
|
70
|
-
const distOutput = path.join(projectData.projectDir,
|
|
70
|
+
const distOutput = path.join(projectData.projectDir, constants_1.VITE_DIST_FOLDER_NAME);
|
|
71
71
|
const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
|
|
72
72
|
if (debugLog) {
|
|
73
73
|
console.log(`Copying from ${distOutput} to ${destDir}.`);
|
|
@@ -96,6 +96,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
96
96
|
console.log("Vite first build completed, resolving compileWithWatch");
|
|
97
97
|
}
|
|
98
98
|
resolve(childProcess);
|
|
99
|
+
return;
|
|
99
100
|
}
|
|
100
101
|
// Transform Vite message to match webpack format
|
|
101
102
|
const files = message.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
|
|
@@ -214,11 +215,31 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
214
215
|
delete this.bundlerProcesses[platformData.platformNameLowerCase];
|
|
215
216
|
reject(err);
|
|
216
217
|
});
|
|
218
|
+
const isVite = this.getBundler() === "vite";
|
|
217
219
|
childProcess.on("close", async (arg) => {
|
|
218
220
|
await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
|
|
219
221
|
delete this.bundlerProcesses[platformData.platformNameLowerCase];
|
|
220
222
|
const exitCode = typeof arg === "number" ? arg : arg && arg.code;
|
|
221
223
|
if (exitCode === 0) {
|
|
224
|
+
// Non-watch Vite builds spawn the child with stdio:"inherit"
|
|
225
|
+
// (no IPC channel), so the emittedFiles message handler in
|
|
226
|
+
// compileWithWatch never fires and the Vite output is never
|
|
227
|
+
// copied to the platforms app folder. Mirror that copy step
|
|
228
|
+
// here so release/CI prepare and build flows actually deploy
|
|
229
|
+
// the freshly built bundle. Without this, the deploy folder
|
|
230
|
+
// is left empty (or worse, runs stale dev/HMR artifacts from
|
|
231
|
+
// a previous `ns debug` run) and the runtime crashes on
|
|
232
|
+
// launch with `Check failed: has_pending_exception()`.
|
|
233
|
+
if (isVite) {
|
|
234
|
+
try {
|
|
235
|
+
const distOutput = path.join(projectData.projectDir, constants_1.VITE_DIST_FOLDER_NAME);
|
|
236
|
+
const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
|
|
237
|
+
this.copyViteBundleToNative(distOutput, destDir);
|
|
238
|
+
}
|
|
239
|
+
catch (copyErr) {
|
|
240
|
+
this.$logger.warn(`Failed to copy Vite output to platform destination: ${copyErr.message}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
222
243
|
resolve();
|
|
223
244
|
}
|
|
224
245
|
else {
|
|
@@ -244,13 +265,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
244
265
|
}
|
|
245
266
|
}
|
|
246
267
|
}
|
|
247
|
-
async shouldUsePreserveSymlinksOption(
|
|
248
|
-
// Modern bundlers (webpack v5+ and rspack) are more sensitive to
|
|
249
|
-
// duplicate module identities when symlink paths are preserved.
|
|
250
|
-
// In local file-linked setups this can load webpack internals twice.
|
|
251
|
-
if (this.isModernBundler(projectData)) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
268
|
+
async shouldUsePreserveSymlinksOption() {
|
|
254
269
|
// pnpm does not require symlink (https://github.com/nodejs/node-eps/issues/46#issuecomment-277373566)
|
|
255
270
|
// and it also does not work in some cases.
|
|
256
271
|
// Check https://github.com/NativeScript/nativescript-cli/issues/5259 for more information
|
|
@@ -282,7 +297,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
282
297
|
]
|
|
283
298
|
: cliArgs;
|
|
284
299
|
const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
|
|
285
|
-
if (await this.shouldUsePreserveSymlinksOption(
|
|
300
|
+
if (await this.shouldUsePreserveSymlinksOption()) {
|
|
286
301
|
additionalNodeArgs.push("--preserve-symlinks");
|
|
287
302
|
}
|
|
288
303
|
if (process.arch === "x64") {
|
|
@@ -318,7 +333,6 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
318
333
|
USER_PROJECT_PLATFORMS_ANDROID: this.$options.hostProjectPath,
|
|
319
334
|
USER_PROJECT_PLATFORMS_ANDROID_MODULE: this.$options.hostProjectModuleName,
|
|
320
335
|
USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
|
|
321
|
-
USER_PROJECT_PLATFORMS_MACOS: this.$options.hostProjectPath,
|
|
322
336
|
});
|
|
323
337
|
}
|
|
324
338
|
if (debugLog) {
|
|
@@ -333,9 +347,6 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
333
347
|
var _a, _b, _c;
|
|
334
348
|
const { env } = prepareData;
|
|
335
349
|
const envData = Object.assign({}, env, { [platform.toLowerCase()]: true });
|
|
336
|
-
if (platform.toLowerCase() === "macos") {
|
|
337
|
-
envData.platform = "macos";
|
|
338
|
-
}
|
|
339
350
|
const appId = projectData.projectIdentifiers[platform];
|
|
340
351
|
const appPath = projectData.getAppDirectoryRelativePath();
|
|
341
352
|
const appResourcesPath = projectData.getAppResourcesRelativeDirectoryPath();
|
|
@@ -43,7 +43,7 @@ class DebugServiceBase extends events_1.EventEmitter {
|
|
|
43
43
|
if (debugOptions.useHttpUrl) {
|
|
44
44
|
chromeDevToolsPrefix = `https://chrome-devtools-frontend.appspot.com/serve_file/@${commitSHA}`;
|
|
45
45
|
}
|
|
46
|
-
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=
|
|
46
|
+
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=127.0.0.1:${port}`;
|
|
47
47
|
return chromeUrl;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -8,11 +8,12 @@ const _ = require("lodash");
|
|
|
8
8
|
const yok_1 = require("../../common/yok");
|
|
9
9
|
const constants = require("../../constants");
|
|
10
10
|
class IOSSigningService {
|
|
11
|
-
constructor($errors, $fs, $iOSProvisionService, $logger, $pbxprojDomXcode, $prompter, $xcconfigService, $xcprojService) {
|
|
11
|
+
constructor($errors, $fs, $iOSProvisionService, $logger, $options, $pbxprojDomXcode, $prompter, $xcconfigService, $xcprojService) {
|
|
12
12
|
this.$errors = $errors;
|
|
13
13
|
this.$fs = $fs;
|
|
14
14
|
this.$iOSProvisionService = $iOSProvisionService;
|
|
15
15
|
this.$logger = $logger;
|
|
16
|
+
this.$options = $options;
|
|
16
17
|
this.$pbxprojDomXcode = $pbxprojDomXcode;
|
|
17
18
|
this.$prompter = $prompter;
|
|
18
19
|
this.$xcconfigService = $xcconfigService;
|
|
@@ -150,6 +151,7 @@ class IOSSigningService {
|
|
|
150
151
|
return [];
|
|
151
152
|
}
|
|
152
153
|
async getManualSigningConfiguration(projectData, provision, mobileProvisionData) {
|
|
154
|
+
var _a;
|
|
153
155
|
const pickStart = Date.now();
|
|
154
156
|
const mobileprovision = mobileProvisionData ||
|
|
155
157
|
(await this.$iOSProvisionService.pick(provision, projectData.projectIdentifiers.ios));
|
|
@@ -162,6 +164,7 @@ class IOSSigningService {
|
|
|
162
164
|
if (!mobileprovision) {
|
|
163
165
|
this.$errors.fail("Failed to find mobile provision with UUID or Name: " + provision);
|
|
164
166
|
}
|
|
167
|
+
const isVisionOS = ((_a = this.$options.platformOverride) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "visionos";
|
|
165
168
|
const configuration = {
|
|
166
169
|
team: mobileprovision.TeamIdentifier &&
|
|
167
170
|
mobileprovision.TeamIdentifier.length > 0
|
|
@@ -170,8 +173,12 @@ class IOSSigningService {
|
|
|
170
173
|
uuid: mobileprovision.UUID,
|
|
171
174
|
name: mobileprovision.Name,
|
|
172
175
|
identity: mobileprovision.Type === "Development"
|
|
173
|
-
?
|
|
174
|
-
|
|
176
|
+
? isVisionOS
|
|
177
|
+
? "Apple Development"
|
|
178
|
+
: "iPhone Developer"
|
|
179
|
+
: isVisionOS
|
|
180
|
+
? "Apple Distribution"
|
|
181
|
+
: "iPhone Distribution",
|
|
175
182
|
};
|
|
176
183
|
return configuration;
|
|
177
184
|
}
|
|
@@ -86,18 +86,11 @@ class SPMService {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
async resolveSPMDependencies(platformData, projectData) {
|
|
89
|
-
let destination = "generic/platform=iOS";
|
|
90
|
-
if (platformData.platformNameLowerCase === "visionos") {
|
|
91
|
-
destination = "generic/platform=visionOS";
|
|
92
|
-
}
|
|
93
|
-
else if (platformData.platformNameLowerCase === "macos") {
|
|
94
|
-
destination = "generic/platform=macOS";
|
|
95
|
-
}
|
|
96
89
|
await this.$xcodebuildCommandService.executeCommand(this.$xcodebuildArgsService
|
|
97
90
|
.getXcodeProjectArgs(platformData, projectData)
|
|
98
91
|
.concat([
|
|
99
92
|
"-destination",
|
|
100
|
-
|
|
93
|
+
"generic/platform=iOS",
|
|
101
94
|
"-resolvePackageDependencies",
|
|
102
95
|
]), {
|
|
103
96
|
cwd: projectData.projectDir,
|
|
@@ -18,11 +18,7 @@ class XcodebuildArgsService {
|
|
|
18
18
|
}
|
|
19
19
|
async getBuildForSimulatorArgs(platformData, projectData, buildConfig) {
|
|
20
20
|
let args = await this.getArchitecturesArgs(buildConfig);
|
|
21
|
-
|
|
22
|
-
if (isMacOS) {
|
|
23
|
-
args = args.concat(["CODE_SIGNING_ALLOWED=NO"]);
|
|
24
|
-
}
|
|
25
|
-
else if (this.$iOSWatchAppService.hasWatchApp(platformData, projectData)) {
|
|
21
|
+
if (this.$iOSWatchAppService.hasWatchApp(platformData, projectData)) {
|
|
26
22
|
args = args.concat(["CODE_SIGNING_ALLOWED=NO"]);
|
|
27
23
|
}
|
|
28
24
|
else {
|
|
@@ -30,9 +26,6 @@ class XcodebuildArgsService {
|
|
|
30
26
|
}
|
|
31
27
|
let destination = "generic/platform=iOS Simulator";
|
|
32
28
|
let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
|
|
33
|
-
if (isMacOS) {
|
|
34
|
-
destination = "generic/platform=macOS";
|
|
35
|
-
}
|
|
36
29
|
if (isvisionOS) {
|
|
37
30
|
destination = "generic/platform=visionOS Simulator";
|
|
38
31
|
if (buildConfig._device) {
|
|
@@ -47,11 +40,9 @@ class XcodebuildArgsService {
|
|
|
47
40
|
"-configuration",
|
|
48
41
|
buildConfig.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug,
|
|
49
42
|
])
|
|
50
|
-
.concat(this.getBuildCommonArgs(platformData, projectData,
|
|
51
|
-
? ios_project_service_1.
|
|
52
|
-
:
|
|
53
|
-
? ios_project_service_1.VisionSimulatorPlatformSdkName
|
|
54
|
-
: ios_project_service_1.SimulatorPlatformSdkName))
|
|
43
|
+
.concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS
|
|
44
|
+
? ios_project_service_1.VisionSimulatorPlatformSdkName
|
|
45
|
+
: ios_project_service_1.SimulatorPlatformSdkName))
|
|
55
46
|
.concat(this.getBuildLoggingArgs())
|
|
56
47
|
.concat(this.getXcodeProjectArgs(platformData, projectData));
|
|
57
48
|
return args;
|
|
@@ -61,10 +52,6 @@ class XcodebuildArgsService {
|
|
|
61
52
|
const archivePath = path.join(platformData.getBuildOutputPath(buildConfig), projectData.projectName + ".xcarchive");
|
|
62
53
|
let destination = "generic/platform=iOS";
|
|
63
54
|
let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
|
|
64
|
-
const isMacOS = this.$devicePlatformsConstants.ismacOS(buildConfig.platform);
|
|
65
|
-
if (isMacOS) {
|
|
66
|
-
destination = "generic/platform=macOS";
|
|
67
|
-
}
|
|
68
55
|
if (isvisionOS) {
|
|
69
56
|
destination = "generic/platform=visionOS";
|
|
70
57
|
if (buildConfig._device) {
|
|
@@ -83,12 +70,13 @@ class XcodebuildArgsService {
|
|
|
83
70
|
]
|
|
84
71
|
.concat(this.getXcodeProjectArgs(platformData, projectData))
|
|
85
72
|
.concat(architectures)
|
|
86
|
-
.concat(this.getBuildCommonArgs(platformData, projectData,
|
|
87
|
-
? ios_project_service_1.MacOSPlatformSdkName
|
|
88
|
-
: isvisionOS
|
|
89
|
-
? ios_project_service_1.VisionDevicePlatformSdkName
|
|
90
|
-
: ios_project_service_1.DevicePlatformSdkName))
|
|
73
|
+
.concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS ? ios_project_service_1.VisionDevicePlatformSdkName : ios_project_service_1.DevicePlatformSdkName))
|
|
91
74
|
.concat(this.getBuildLoggingArgs());
|
|
75
|
+
// pbxproj-dom sets CODE_SIGN_IDENTITY[sdk=iphoneos*] which doesn't match
|
|
76
|
+
// the xros SDK used by visionOS builds — pass it explicitly as an override
|
|
77
|
+
if (isvisionOS) {
|
|
78
|
+
args.push(`CODE_SIGN_IDENTITY=${buildConfig.release ? "Apple Distribution" : "Apple Development"}`);
|
|
79
|
+
}
|
|
92
80
|
return args;
|
|
93
81
|
}
|
|
94
82
|
async getArchitecturesArgs(buildConfig) {
|
|
@@ -99,13 +87,6 @@ class XcodebuildArgsService {
|
|
|
99
87
|
args.push("ONLY_ACTIVE_ARCH=YES", "EXCLUDED_ARCHS=x86_64");
|
|
100
88
|
return args;
|
|
101
89
|
}
|
|
102
|
-
if (this.$devicePlatformsConstants.ismacOS(buildConfig.platform)) {
|
|
103
|
-
if (process.arch === "arm64") {
|
|
104
|
-
// Avoid attempting x86_64 builds against arm64-only frameworks.
|
|
105
|
-
args.push("ONLY_ACTIVE_ARCH=YES", "EXCLUDED_ARCHS=x86_64");
|
|
106
|
-
}
|
|
107
|
-
return args;
|
|
108
|
-
}
|
|
109
90
|
const devicesArchitectures = buildConfig.buildForDevice
|
|
110
91
|
? await this.getArchitecturesFromConnectedDevices(buildConfig)
|
|
111
92
|
: [];
|
|
@@ -21,7 +21,9 @@ class IOSEntitlementsService {
|
|
|
21
21
|
}
|
|
22
22
|
getPlatformsEntitlementsPath(projectData) {
|
|
23
23
|
var _a;
|
|
24
|
-
return path.join(projectData.platformsDir,
|
|
24
|
+
return path.join(projectData.platformsDir, this.$mobileHelper
|
|
25
|
+
.normalizePlatformName((_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : this.$devicePlatformsConstants.iOS)
|
|
26
|
+
.toLowerCase(), projectData.projectName, projectData.projectName + ".entitlements");
|
|
25
27
|
}
|
|
26
28
|
getPlatformsEntitlementsRelativePath(projectData) {
|
|
27
29
|
return path.join(projectData.projectName, projectData.projectName + ".entitlements");
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.IOSProjectService = exports.
|
|
9
|
+
exports.IOSProjectService = exports.VisionSimulatorPlatformSdkName = exports.VisionDevicePlatformSdkName = exports.SimulatorPlatformSdkName = exports.DevicePlatformSdkName = void 0;
|
|
10
10
|
const path = require("path");
|
|
11
11
|
const shell = require("shelljs");
|
|
12
12
|
const _ = require("lodash");
|
|
@@ -26,24 +26,17 @@ exports.DevicePlatformSdkName = "iphoneos";
|
|
|
26
26
|
exports.SimulatorPlatformSdkName = "iphonesimulator";
|
|
27
27
|
exports.VisionDevicePlatformSdkName = "xros";
|
|
28
28
|
exports.VisionSimulatorPlatformSdkName = "xrsimulator";
|
|
29
|
-
exports.MacOSPlatformSdkName = "macosx";
|
|
30
29
|
const FRAMEWORK_EXTENSIONS = [".framework", ".xcframework"];
|
|
31
30
|
const getPlatformSdkName = (buildData) => {
|
|
32
31
|
const forDevice = !buildData || buildData.buildForDevice || buildData.buildForAppStore;
|
|
33
32
|
const isvisionOS = yok_1.injector
|
|
34
33
|
.resolve("devicePlatformsConstants")
|
|
35
34
|
.isvisionOS(buildData.platform);
|
|
36
|
-
const ismacOS = yok_1.injector
|
|
37
|
-
.resolve("devicePlatformsConstants")
|
|
38
|
-
.ismacOS(buildData.platform);
|
|
39
35
|
if (isvisionOS) {
|
|
40
36
|
return forDevice
|
|
41
37
|
? exports.VisionDevicePlatformSdkName
|
|
42
38
|
: exports.VisionSimulatorPlatformSdkName;
|
|
43
39
|
}
|
|
44
|
-
if (ismacOS) {
|
|
45
|
-
return exports.MacOSPlatformSdkName;
|
|
46
|
-
}
|
|
47
40
|
return forDevice ? exports.DevicePlatformSdkName : exports.SimulatorPlatformSdkName;
|
|
48
41
|
};
|
|
49
42
|
const getConfigurationName = (release) => {
|
|
@@ -79,6 +72,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
79
72
|
this.$mobileHelper = $mobileHelper;
|
|
80
73
|
this.$projectConfigService = $projectConfigService;
|
|
81
74
|
this._platformsDirCache = null;
|
|
75
|
+
this._platformOverrideCache = null;
|
|
82
76
|
this._platformData = null;
|
|
83
77
|
// Track added frameworks by name to prevent duplicates in monorepo/workspace setups
|
|
84
78
|
// where the same plugin may exist in multiple node_modules paths
|
|
@@ -87,19 +81,20 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
87
81
|
this._addedStaticLibs = new Set();
|
|
88
82
|
}
|
|
89
83
|
getPlatformData(projectData) {
|
|
90
|
-
var _a;
|
|
84
|
+
var _a, _b;
|
|
91
85
|
if (!projectData && !this._platformData) {
|
|
92
86
|
throw new Error("First call of getPlatformData without providing projectData.");
|
|
93
87
|
}
|
|
88
|
+
const currentOverride = (_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : null;
|
|
94
89
|
if (projectData &&
|
|
95
90
|
projectData.platformsDir &&
|
|
96
|
-
this._platformsDirCache !== projectData.platformsDir
|
|
97
|
-
|
|
91
|
+
(this._platformsDirCache !== projectData.platformsDir ||
|
|
92
|
+
this._platformOverrideCache !== currentOverride)) {
|
|
93
|
+
const platform = this.$mobileHelper.normalizePlatformName((_b = this.$options.platformOverride) !== null && _b !== void 0 ? _b : this.$devicePlatformsConstants.iOS);
|
|
98
94
|
const projectRoot = this.$options.hostProjectPath
|
|
99
95
|
? this.$options.hostProjectPath
|
|
100
96
|
: path.join(projectData.platformsDir, platform.toLowerCase());
|
|
101
97
|
const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, platform.toLowerCase());
|
|
102
|
-
const isMacOSPlatform = this.$devicePlatformsConstants.ismacOS(platform);
|
|
103
98
|
this._platformData = {
|
|
104
99
|
frameworkPackageName: runtimePackage.name,
|
|
105
100
|
normalizedPlatformName: platform,
|
|
@@ -109,22 +104,9 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
109
104
|
projectRoot: projectRoot,
|
|
110
105
|
getBuildOutputPath: (options) => {
|
|
111
106
|
const config = getConfigurationName(!options || options.release);
|
|
112
|
-
if (isMacOSPlatform) {
|
|
113
|
-
return path.join(projectRoot, constants.BUILD_DIR, config);
|
|
114
|
-
}
|
|
115
107
|
return path.join(projectRoot, constants.BUILD_DIR, `${config}-${getPlatformSdkName(options)}`);
|
|
116
108
|
},
|
|
117
109
|
getValidBuildOutputData: (buildOptions) => {
|
|
118
|
-
const isMacOS = !!buildOptions &&
|
|
119
|
-
this.$devicePlatformsConstants.ismacOS(buildOptions.platform);
|
|
120
|
-
if (isMacOS) {
|
|
121
|
-
return {
|
|
122
|
-
packageNames: [
|
|
123
|
-
`${projectData.projectName}.app`,
|
|
124
|
-
`${projectData.projectName}.zip`,
|
|
125
|
-
],
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
110
|
const forDevice = !buildOptions ||
|
|
129
111
|
!!buildOptions.buildForDevice ||
|
|
130
112
|
!!buildOptions.buildForAppStore;
|
|
@@ -166,15 +148,11 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
166
148
|
".xbm",
|
|
167
149
|
], // https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/
|
|
168
150
|
};
|
|
151
|
+
this._platformsDirCache = projectData.platformsDir;
|
|
152
|
+
this._platformOverrideCache = currentOverride;
|
|
169
153
|
}
|
|
170
154
|
return this._platformData;
|
|
171
155
|
}
|
|
172
|
-
getPluginPlatform(projectData) {
|
|
173
|
-
var _a;
|
|
174
|
-
const platformData = this.getPlatformData(projectData);
|
|
175
|
-
return (((_a = platformData.normalizedPlatformName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ||
|
|
176
|
-
platformData.platformNameLowerCase);
|
|
177
|
-
}
|
|
178
156
|
async validateOptions(projectId, provision, teamId) {
|
|
179
157
|
if (provision && teamId) {
|
|
180
158
|
this.$errors.fail("The options --provision and --teamId are mutually exclusive.");
|
|
@@ -379,10 +357,10 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
379
357
|
this.savePbxProj(project, projectData);
|
|
380
358
|
}
|
|
381
359
|
async prepareProject(projectData, prepareData) {
|
|
360
|
+
const platformData = this.getPlatformData(projectData);
|
|
382
361
|
const projectRoot = this.$options.hostProjectPath
|
|
383
362
|
? this.$options.hostProjectPath
|
|
384
|
-
:
|
|
385
|
-
const platformData = this.getPlatformData(projectData);
|
|
363
|
+
: platformData.projectRoot;
|
|
386
364
|
const pluginsData = this.getAllProductionPlugins(projectData);
|
|
387
365
|
const pbxProjPath = this.getPbxProjPath(projectData);
|
|
388
366
|
this.$iOSExtensionsService.removeExtensions({ pbxProjPath });
|
|
@@ -490,7 +468,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
490
468
|
}
|
|
491
469
|
}
|
|
492
470
|
}
|
|
493
|
-
this.$iOSWatchAppService.removeWatchApp({ pbxProjPath });
|
|
494
471
|
const addedWatchApp = await this.$iOSWatchAppService.addWatchAppFromPath({
|
|
495
472
|
watchAppFolderPath: path.join(resourcesDirectoryPath, platformData.normalizedPlatformName),
|
|
496
473
|
projectData,
|
|
@@ -522,13 +499,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
522
499
|
this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, constants.NATIVE_EXTENSION_FOLDER));
|
|
523
500
|
this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, "watchapp"));
|
|
524
501
|
this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, "watchextension"));
|
|
525
|
-
const macOSPlatformName = this.$devicePlatformsConstants.macOS &&
|
|
526
|
-
this.$devicePlatformsConstants.macOS.toLowerCase();
|
|
527
|
-
if (macOSPlatformName &&
|
|
528
|
-
platformData.platformNameLowerCase === macOSPlatformName) {
|
|
529
|
-
// macOS apps do not use iOS launch storyboards.
|
|
530
|
-
this.$fs.deleteFile(path.join(platformsAppResourcesPath, "LaunchScreen.storyboard"));
|
|
531
|
-
}
|
|
532
502
|
}
|
|
533
503
|
async processConfigurationFilesFromAppResources(projectData, opts) {
|
|
534
504
|
await this.mergeInfoPlists(projectData, opts);
|
|
@@ -560,9 +530,8 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
560
530
|
});
|
|
561
531
|
};
|
|
562
532
|
const allPlugins = this.getAllProductionPlugins(projectData);
|
|
563
|
-
const pluginPlatform = this.getPluginPlatform(projectData);
|
|
564
533
|
for (const plugin of allPlugins) {
|
|
565
|
-
const pluginInfoPlistPath = path.join(plugin.pluginPlatformsFolderPath(
|
|
534
|
+
const pluginInfoPlistPath = path.join(plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME), this.getPlatformData(projectData).configurationFileName);
|
|
566
535
|
makePatch(pluginInfoPlistPath);
|
|
567
536
|
}
|
|
568
537
|
makePatch(infoPlistPath);
|
|
@@ -647,17 +616,16 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
647
616
|
return this.$fs.writeFile(this.getPbxProjPath(projectData), project.writeSync({ omitEmptyValues }));
|
|
648
617
|
}
|
|
649
618
|
async preparePluginNativeCode(pluginData, projectData, opts) {
|
|
650
|
-
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(
|
|
651
|
-
const sourcePath =
|
|
619
|
+
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
|
|
620
|
+
const sourcePath = path.join(pluginPlatformsFolderPath, "src");
|
|
652
621
|
await this.prepareNativeSourceCode(pluginData.name, sourcePath, projectData);
|
|
653
622
|
await this.prepareResources(pluginPlatformsFolderPath, pluginData, projectData);
|
|
654
623
|
await this.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
|
|
655
624
|
await this.prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData);
|
|
656
625
|
}
|
|
657
626
|
async removePluginNativeCode(pluginData, projectData) {
|
|
658
|
-
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(
|
|
659
|
-
|
|
660
|
-
this.removeNativeSourceCode(sourcePath, pluginData, projectData);
|
|
627
|
+
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
|
|
628
|
+
this.removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData);
|
|
661
629
|
this.removeFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
|
|
662
630
|
this.removeStaticLibs(pluginPlatformsFolderPath, pluginData, projectData);
|
|
663
631
|
const projectRoot = this.getPlatformData(projectData).projectRoot;
|
|
@@ -762,12 +730,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
762
730
|
], projectData.projectName, project);
|
|
763
731
|
this.savePbxProj(project, projectData);
|
|
764
732
|
}
|
|
765
|
-
getAllLibsForPluginWithFileExtension(pluginData, fileExtension
|
|
733
|
+
getAllLibsForPluginWithFileExtension(pluginData, fileExtension) {
|
|
766
734
|
const fileExtensions = _.isArray(fileExtension)
|
|
767
735
|
? fileExtension
|
|
768
736
|
: [fileExtension];
|
|
769
737
|
const filterCallback = (fileName, pluginPlatformsFolderPath) => fileExtensions.indexOf(path.extname(fileName)) !== -1;
|
|
770
|
-
return this.getAllNativeLibrariesForPlugin(pluginData,
|
|
738
|
+
return this.getAllNativeLibrariesForPlugin(pluginData, IOSProjectService.IOS_PLATFORM_NAME, filterCallback);
|
|
771
739
|
}
|
|
772
740
|
validateFramework(libraryPath) {
|
|
773
741
|
const infoPlistPath = path.join(libraryPath, constants.INFO_PLIST_FILE_NAME);
|
|
@@ -807,21 +775,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
807
775
|
}
|
|
808
776
|
this.savePbxProj(project, projectData);
|
|
809
777
|
}
|
|
810
|
-
getPluginNativeSourcePath(pluginData, projectData, pluginPlatformsFolderPath) {
|
|
811
|
-
const sourcePath = path.join(pluginPlatformsFolderPath, "src");
|
|
812
|
-
if (this.$fs.exists(sourcePath)) {
|
|
813
|
-
return sourcePath;
|
|
814
|
-
}
|
|
815
|
-
// For macOS only, allow reusing plugin native source code from iOS.
|
|
816
|
-
// Framework/static library discovery remains strict to `platforms/macos`.
|
|
817
|
-
if (this.$devicePlatformsConstants.ismacOS(this.getPlatformData(projectData).normalizedPlatformName)) {
|
|
818
|
-
const iosSourcePath = path.join(pluginData.pluginPlatformsFolderPath("ios" /* constants.PlatformTypes.ios */), "src");
|
|
819
|
-
if (this.$fs.exists(iosSourcePath)) {
|
|
820
|
-
return iosSourcePath;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
return sourcePath;
|
|
824
|
-
}
|
|
825
778
|
async addExtensions(projectData, pluginsData) {
|
|
826
779
|
const resorcesExtensionsPath = path.join(projectData.getAppResourcesDirectoryPath(), this.getPlatformData(projectData).normalizedPlatformName, constants.NATIVE_EXTENSION_FOLDER);
|
|
827
780
|
const platformData = this.getPlatformData(projectData);
|
|
@@ -835,7 +788,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
835
788
|
let addedExtensionsFromPlugins = false;
|
|
836
789
|
for (const pluginIndex in pluginsData) {
|
|
837
790
|
const pluginData = pluginsData[pluginIndex];
|
|
838
|
-
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(
|
|
791
|
+
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
|
|
839
792
|
const extensionPath = path.join(pluginPlatformsFolderPath, constants.NATIVE_EXTENSION_FOLDER);
|
|
840
793
|
const addedExtensionFromPlugin = await this.$iOSExtensionsService.addExtensionsFromPath({
|
|
841
794
|
extensionsFolderPath: extensionPath,
|
|
@@ -890,25 +843,25 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
890
843
|
this.savePbxProj(project, projectData);
|
|
891
844
|
}
|
|
892
845
|
async prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData) {
|
|
893
|
-
for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS
|
|
846
|
+
for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS)) {
|
|
894
847
|
await this.addFramework(path.join(pluginPlatformsFolderPath, fileName), projectData);
|
|
895
848
|
}
|
|
896
849
|
}
|
|
897
850
|
async prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData) {
|
|
898
|
-
for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, ".a"
|
|
851
|
+
for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, ".a")) {
|
|
899
852
|
await this.addStaticLibrary(path.join(pluginPlatformsFolderPath, fileName), projectData);
|
|
900
853
|
}
|
|
901
854
|
}
|
|
902
|
-
async removeNativeSourceCode(
|
|
855
|
+
async removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData) {
|
|
903
856
|
const project = this.createPbxProj(projectData);
|
|
904
|
-
const group = await this.getRootGroup(pluginData.name,
|
|
857
|
+
const group = await this.getRootGroup(pluginData.name, pluginPlatformsFolderPath);
|
|
905
858
|
project.removePbxGroup(group.name, group.path);
|
|
906
859
|
project.removeFromHeaderSearchPaths(group.path);
|
|
907
860
|
this.savePbxProj(project, projectData);
|
|
908
861
|
}
|
|
909
862
|
removeFrameworks(pluginPlatformsFolderPath, pluginData, projectData) {
|
|
910
863
|
const project = this.createPbxProj(projectData);
|
|
911
|
-
_.each(this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS
|
|
864
|
+
_.each(this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS), (fileName) => {
|
|
912
865
|
const relativeFrameworkPath = this.getLibSubpathRelativeToProjectPath(fileName, projectData);
|
|
913
866
|
project.removeFramework(relativeFrameworkPath, {
|
|
914
867
|
customFramework: true,
|
|
@@ -919,7 +872,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
919
872
|
}
|
|
920
873
|
removeStaticLibs(pluginPlatformsFolderPath, pluginData, projectData) {
|
|
921
874
|
const project = this.createPbxProj(projectData);
|
|
922
|
-
_.each(this.getAllLibsForPluginWithFileExtension(pluginData, ".a"
|
|
875
|
+
_.each(this.getAllLibsForPluginWithFileExtension(pluginData, ".a"), (fileName) => {
|
|
923
876
|
const staticLibPath = path.join(pluginPlatformsFolderPath, fileName);
|
|
924
877
|
const relativeStaticLibPath = this.getLibSubpathRelativeToProjectPath(path.basename(staticLibPath), projectData);
|
|
925
878
|
project.removeFramework(relativeStaticLibPath);
|
|
@@ -953,9 +906,8 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
953
906
|
this.$fs.deleteFile(pluginsXcconfigFilePath);
|
|
954
907
|
}
|
|
955
908
|
const allPlugins = this.getAllProductionPlugins(projectData);
|
|
956
|
-
const pluginPlatform = this.getPluginPlatform(projectData);
|
|
957
909
|
for (const plugin of allPlugins) {
|
|
958
|
-
const pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(
|
|
910
|
+
const pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
|
|
959
911
|
const pluginXcconfigFilePath = path.join(pluginPlatformsFolderPath, constants_2.BUILD_XCCONFIG_FILE_NAME);
|
|
960
912
|
if (this.$fs.exists(pluginXcconfigFilePath)) {
|
|
961
913
|
for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
|
|
@@ -1018,6 +970,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
1018
970
|
}
|
|
1019
971
|
exports.IOSProjectService = IOSProjectService;
|
|
1020
972
|
IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
|
|
973
|
+
IOSProjectService.IOS_PLATFORM_NAME = "ios";
|
|
1021
974
|
__decorate([
|
|
1022
975
|
(0, helpers_2.hook)("buildIOS")
|
|
1023
976
|
], IOSProjectService.prototype, "buildProject", null);
|