nativescript 9.0.6-dev.1 → 9.0.6-dev.3

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.
@@ -865,6 +865,7 @@ interface IAddExtensionsFromPathOptions extends IAddTargetFromPathOptions {
865
865
 
866
866
  interface IAddWatchAppFromPathOptions extends IAddTargetFromPathOptions {
867
867
  watchAppFolderPath: string;
868
+ disableStubBinary?: boolean;
868
869
  }
869
870
 
870
871
  interface IRemoveExtensionsOptions {
@@ -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));
@@ -69,11 +69,13 @@ class IOSWatchAppService {
69
69
  const file = project.addSourceFile(path, opt, group);
70
70
  project.addToResourcesPbxGroup(file, group);
71
71
  }
72
- async addWatchAppFromPath({ watchAppFolderPath, projectData, platformData, pbxProjPath, }) {
72
+ async addWatchAppFromPath({ watchAppFolderPath, projectData, platformData, pbxProjPath, disableStubBinary = false, }) {
73
73
  var _a, _b;
74
74
  const targetUuids = [];
75
75
  const targetNames = [];
76
76
  const appPath = path.join(watchAppFolderPath, constants_1.IOS_WATCHAPP_FOLDER);
77
+ const extensionPath = path.join(watchAppFolderPath, constants_1.IOS_WATCHAPP_EXTENSION_FOLDER);
78
+ const hasWatchExtension = this.$fs.exists(extensionPath);
77
79
  // Check if watchapp exists - it's required
78
80
  if (!this.$fs.exists(appPath)) {
79
81
  return false;
@@ -90,12 +92,11 @@ class IOSWatchAppService {
90
92
  project.removeTargetsByProductType(targetType);
91
93
  const parentTargetUuid = project.getFirstTarget().uuid;
92
94
  const watchApptarget = this.addTarget(appPath, appFolder, targetType, project, platformData, parentTargetUuid, constants_1.IOSNativeTargetTypes.watchApp);
93
- await this.configureTarget(appFolder, path.join(appPath, appFolder), `${projectData.projectIdentifiers.ios}.${WATCH_APP_IDENTIFIER}`, configPath, config, watchApptarget, project, projectData, platformData, pbxProjPath);
95
+ await this.configureTarget(appFolder, path.join(appPath, appFolder), `${projectData.projectIdentifiers.ios}.${WATCH_APP_IDENTIFIER}`, configPath, config, watchApptarget, project, projectData, platformData, pbxProjPath, !hasWatchExtension);
94
96
  targetUuids.push(watchApptarget.uuid);
95
97
  targetNames.push(appFolder);
96
- const extensionPath = path.join(watchAppFolderPath, constants_1.IOS_WATCHAPP_EXTENSION_FOLDER);
97
98
  // Extension is optional (Xcode 14+ supports single target)
98
- if (this.$fs.exists(extensionPath)) {
99
+ if (hasWatchExtension) {
99
100
  const extensionFolder = this.$iOSNativeTargetService.getTargetDirectories(extensionPath)[0];
100
101
  const configPath = path.join(path.join(extensionPath, extensionFolder), "extension.json");
101
102
  const config = this.$fs.exists(configPath)
@@ -118,6 +119,9 @@ class IOSWatchAppService {
118
119
  await this.applySPMPackagesToTargets(targetNames, platformData, projectData.projectDir, watchSPMPackages);
119
120
  // nothing done after we dont need to reload project
120
121
  this.$iOSNativeTargetService.prepareSigning(targetUuids, projectData, pbxProjPath);
122
+ if (disableStubBinary) {
123
+ this.applyWatchAppStubBinaryOverrides(appFolder, pbxProjPath);
124
+ }
121
125
  return true;
122
126
  }
123
127
  addTarget(targetRootPath, targetFolder, targetType, project, platformData, parentTarget, productTargetType) {
@@ -213,7 +217,7 @@ class IOSWatchAppService {
213
217
  const watchAppPath = path.join(projectData.getAppResourcesDirectoryPath(), platformData.normalizedPlatformName, constants_1.IOS_WATCHAPP_FOLDER);
214
218
  return this.$fs.exists(watchAppPath);
215
219
  }
216
- async configureTarget(targetName, targetPath, identifier, configPath, config, target, project, projectData, platformData, pbxProjPath) {
220
+ async configureTarget(targetName, targetPath, identifier, configPath, config, target, project, projectData, platformData, pbxProjPath, disableStubBinary = false) {
217
221
  const identifierParts = identifier.split(".");
218
222
  identifierParts.pop();
219
223
  const wkAppBundleIdentifier = identifierParts.join(".");
@@ -225,6 +229,9 @@ class IOSWatchAppService {
225
229
  { name: "WATCHOS_DEPLOYMENT_TARGET", value: 5.2 },
226
230
  { name: "WK_APP_BUNDLE_IDENTIFIER", value: wkAppBundleIdentifier },
227
231
  ];
232
+ if (disableStubBinary) {
233
+ buildConfigProperties.push({ name: "PRODUCT_BINARY_SOURCE_PATH", value: '""' }, { name: "PRODUCT_TYPE_HAS_STUB_BINARY", value: "NO" });
234
+ }
228
235
  const resourcesGroup = targetName + "Resources";
229
236
  project.addPbxGroup([], resourcesGroup, project.filepath, null, {
230
237
  isMain: true,
@@ -291,6 +298,15 @@ class IOSWatchAppService {
291
298
  await this.processWatchAppConfiguration(config, basedir, targetName, target, project, projectData, platformData, pbxProjPath, srcExclude, resourcesExclude);
292
299
  }
293
300
  }
301
+ applyWatchAppStubBinaryOverrides(targetName, pbxProjPath) {
302
+ const project = new this.$xcode.project(pbxProjPath);
303
+ project.parseSync();
304
+ this.$iOSNativeTargetService.setXcodeTargetBuildConfigurationProperties([
305
+ { name: "PRODUCT_BINARY_SOURCE_PATH", value: '""' },
306
+ { name: "PRODUCT_TYPE_HAS_STUB_BINARY", value: "NO" },
307
+ ], targetName, project);
308
+ this.$fs.writeFile(pbxProjPath, project.writeSync({ omitEmptyValues: true }));
309
+ }
294
310
  async processWatchAppConfiguration(config, basedir, targetName, target, project, projectData, platformData, pbxProjPath, srcExclude, resourcesExclude) {
295
311
  this.$logger.debug(`processWatchAppConfiguration ${JSON.stringify(config)}`);
296
312
  // Handle custom resources
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nativescript",
3
3
  "main": "./lib/nativescript-cli-lib.js",
4
- "version": "9.0.6-dev.1",
4
+ "version": "9.0.6-dev.3",
5
5
  "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {