nativescript 8.8.0-alpha.0 → 8.8.0-embed.0

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.
Files changed (40) hide show
  1. package/lib/base-package-manager.js +1 -0
  2. package/lib/commands/add-platform.js +1 -1
  3. package/lib/commands/typings.js +1 -1
  4. package/lib/common/mobile/android/android-virtual-device-service.js +1 -1
  5. package/lib/common/mobile/application-manager-base.js +3 -2
  6. package/lib/controllers/prepare-controller.js +6 -3
  7. package/lib/data/build-data.js +2 -0
  8. package/lib/data/prepare-data.js +1 -0
  9. package/lib/declarations.d.ts +12 -2
  10. package/lib/definitions/platform.d.ts +1 -0
  11. package/lib/helpers/platform-command-helper.js +15 -3
  12. package/lib/options.js +7 -0
  13. package/lib/providers/project-files-provider.js +1 -1
  14. package/lib/services/android/gradle-build-args-service.js +6 -2
  15. package/lib/services/android/gradle-command-service.js +5 -1
  16. package/lib/services/android-plugin-build-service.js +26 -16
  17. package/lib/services/android-project-service.js +18 -15
  18. package/lib/services/assets-generation/assets-generation-service.js +8 -1
  19. package/lib/services/files-hash-service.js +3 -2
  20. package/lib/services/ios-project-service.js +23 -3
  21. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -4
  22. package/lib/services/livesync/android-livesync-service.js +2 -2
  23. package/lib/services/livesync/ios-livesync-service.js +2 -2
  24. package/lib/services/livesync/platform-livesync-service-base.js +4 -3
  25. package/lib/services/log-source-map-service.js +3 -2
  26. package/lib/services/platform/add-platform-service.js +8 -2
  27. package/lib/services/platform/prepare-native-platform-service.js +6 -3
  28. package/lib/services/platform-environment-requirements.js +3 -1
  29. package/lib/services/plugins-service.js +7 -1
  30. package/lib/services/project-changes-service.js +8 -1
  31. package/lib/services/webpack/webpack-compiler-service.js +14 -6
  32. package/lib/services/xcproj-service.js +12 -0
  33. package/package.json +14 -12
  34. package/vendor/aab-tool/README.txt +1 -1
  35. package/vendor/aab-tool/bundletool.jar +0 -0
  36. package/vendor/gradle-plugin/build.gradle +36 -27
  37. package/vendor/gradle-plugin/settings.gradle +13 -3
  38. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +0 -15
  39. package/node_modules/rimraf/CHANGELOG.md +0 -65
  40. package/node_modules/stringify-package/CHANGELOG.md +0 -16
@@ -73,6 +73,7 @@ class BasePackageManager {
73
73
  yield this.$childProcess.spawnFromEvent(npmExecutable, params, "close", {
74
74
  cwd: opts.cwd,
75
75
  stdio: stdioValue,
76
+ shell: this.$hostInfo.isWindows,
76
77
  });
77
78
  const { isInstallingAllDependencies } = opts;
78
79
  if (isInstallingAllDependencies) {
@@ -22,7 +22,7 @@ class AddPlatformCommand extends command_base_1.ValidatePlatformCommandBase {
22
22
  }
23
23
  execute(args) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- yield this.$platformCommandHelper.addPlatforms(args, this.$projectData, this.$options.frameworkPath);
25
+ yield this.$platformCommandHelper.addPlatforms(args, this.$projectData, this.$options.frameworkPath, this.$options.nativeHost);
26
26
  });
27
27
  }
28
28
  canExecute(args) {
@@ -137,7 +137,7 @@ class TypingsCommand {
137
137
  const dtsGeneratorPath = path.resolve(this.$projectData.projectDir, "platforms", "android", "build-tools", "dts-generator.jar");
138
138
  if (!this.$fs.exists(dtsGeneratorPath)) {
139
139
  this.$logger.warn("No platforms folder found, preparing project now...");
140
- yield this.$childProcess.spawnFromEvent(this.$hostInfo.isWindows ? "ns.cmd" : "ns", ["prepare", "android"], "exit", { stdio: "inherit" });
140
+ yield this.$childProcess.spawnFromEvent(this.$hostInfo.isWindows ? "ns.cmd" : "ns", ["prepare", "android"], "exit", { stdio: "inherit", shell: this.$hostInfo.isWindows });
141
141
  }
142
142
  const asArray = (input) => {
143
143
  if (!input) {
@@ -152,7 +152,7 @@ class AndroidVirtualDeviceService {
152
152
  ];
153
153
  }
154
154
  if (canExecuteAvdManagerCommand) {
155
- result = yield this.$childProcess.trySpawnFromCloseEvent(this.pathToAvdManagerExecutable, ["list", "avds"]);
155
+ result = yield this.$childProcess.trySpawnFromCloseEvent(this.pathToAvdManagerExecutable, ["list", "avds"], { shell: this.$hostInfo.isWindows });
156
156
  }
157
157
  else if (this.pathToAndroidExecutable &&
158
158
  this.$fs.exists(this.pathToAndroidExecutable)) {
@@ -31,7 +31,7 @@ class ApplicationManagerBase extends events_1.EventEmitter {
31
31
  reinstallApplication(appIdentifier, packageFilePath, buildData) {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
33
  const isApplicationInstalled = yield this.isApplicationInstalled(appIdentifier);
34
- if (isApplicationInstalled) {
34
+ if (isApplicationInstalled && (buildData === null || buildData === void 0 ? void 0 : buildData.clean)) {
35
35
  yield this.uninstallApplication(appIdentifier);
36
36
  }
37
37
  yield this.installApplication(packageFilePath, appIdentifier, buildData);
@@ -127,7 +127,8 @@ class ApplicationManagerBase extends events_1.EventEmitter {
127
127
  this.emit("debuggableViewChanged", appIdentifier, view);
128
128
  }
129
129
  });
130
- this.lastAvailableDebuggableAppViews[appIdentifier] = currentlyAvailableViews;
130
+ this.lastAvailableDebuggableAppViews[appIdentifier] =
131
+ currentlyAvailableViews;
131
132
  });
132
133
  });
133
134
  }
@@ -25,12 +25,13 @@ const helpers_1 = require("../common/helpers");
25
25
  const yok_1 = require("../common/yok");
26
26
  const constants_1 = require("../constants");
27
27
  class PrepareController extends events_1.EventEmitter {
28
- constructor($platformController, $hooksService, $fs, $logger, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
28
+ constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
29
29
  super();
30
30
  this.$platformController = $platformController;
31
31
  this.$hooksService = $hooksService;
32
32
  this.$fs = $fs;
33
33
  this.$logger = $logger;
34
+ this.$options = $options;
34
35
  this.$mobileHelper = $mobileHelper;
35
36
  this.$nodeModulesDependenciesBuilder = $nodeModulesDependenciesBuilder;
36
37
  this.$platformsDataService = $platformsDataService;
@@ -86,7 +87,9 @@ class PrepareController extends events_1.EventEmitter {
86
87
  prepareCore(prepareData, projectData) {
87
88
  return __awaiter(this, void 0, void 0, function* () {
88
89
  yield this.$projectService.ensureAppResourcesExist(projectData.projectDir);
89
- yield this.$platformController.addPlatformIfNeeded(prepareData, projectData);
90
+ if (!this.$options.nativeHost) {
91
+ yield this.$platformController.addPlatformIfNeeded(prepareData, projectData);
92
+ }
90
93
  yield this.trackRuntimeVersion(prepareData.platform, projectData);
91
94
  this.$logger.info("Preparing project...");
92
95
  prepareData.env = prepareData.env || {};
@@ -272,7 +275,7 @@ class PrepareController extends events_1.EventEmitter {
272
275
  packagePath = path.join(platformData.projectRoot, projectData.projectName, "app", "package.json");
273
276
  }
274
277
  else {
275
- packagePath = path.join(platformData.projectRoot, "app", "src", "main", "assets", "app", "package.json");
278
+ packagePath = path.join(platformData.projectRoot, this.$options.nativeHostModule, "src", this.$options.nativeHost ? "nativescript" : "main", "assets", "app", "package.json");
276
279
  }
277
280
  try {
278
281
  const emittedPackageData = this.$fs.readJson(packagePath);
@@ -24,6 +24,7 @@ class IOSBuildData extends BuildData {
24
24
  this.mobileProvisionData = data.mobileProvisionData;
25
25
  this.buildForAppStore = data.buildForAppStore;
26
26
  this.iCloudContainerEnvironment = data.iCloudContainerEnvironment;
27
+ this.nativeHost = data.nativeHost;
27
28
  }
28
29
  }
29
30
  exports.IOSBuildData = IOSBuildData;
@@ -37,6 +38,7 @@ class AndroidBuildData extends BuildData {
37
38
  this.androidBundle = data.androidBundle || data.aab;
38
39
  this.gradlePath = data.gradlePath;
39
40
  this.gradleArgs = data.gradleArgs;
41
+ this.nativeHost = data.nativeHost;
40
42
  }
41
43
  }
42
44
  exports.AndroidBuildData = AndroidBuildData;
@@ -29,6 +29,7 @@ class PrepareData extends controller_data_base_1.ControllerDataBase {
29
29
  if (_.isBoolean(data.watchNative)) {
30
30
  this.watchNative = data.watchNative;
31
31
  }
32
+ this.nativeHost = data.nativeHost;
32
33
  }
33
34
  }
34
35
  exports.PrepareData = PrepareData;
@@ -578,11 +578,18 @@ interface IAndroidBundleOptions {
578
578
  aab: boolean;
579
579
  }
580
580
 
581
- interface IAndroidOptions {
581
+ interface IEmbedOptions {
582
+ nativeHost: string;
583
+ nativeHostModule: string;
584
+ }
585
+
586
+ interface IAndroidOptions extends IEmbedOptions {
582
587
  gradlePath: string;
583
588
  gradleArgs: string;
584
589
  }
585
590
 
591
+ interface IIOSOptions extends IEmbedOptions {}
592
+
586
593
  interface ITypingsOptions {
587
594
  jar: string;
588
595
  aar: string;
@@ -603,6 +610,7 @@ interface IOptions
603
610
  IProvision,
604
611
  ITeamIdentifier,
605
612
  IAndroidOptions,
613
+ IIOSOptions,
606
614
  IAndroidReleaseOptions,
607
615
  IAndroidBundleOptions,
608
616
  INpmInstallConfigurationOptions,
@@ -1009,6 +1017,7 @@ interface IXcprojService {
1009
1017
  * @return {string} The full path to the xcodeproj
1010
1018
  */
1011
1019
  getXcodeprojPath(projectData: IProjectData, projectRoot: string): string;
1020
+ findXcodeProject(dir: string): string;
1012
1021
  }
1013
1022
 
1014
1023
  /**
@@ -1216,7 +1225,8 @@ interface IPlatformCommandHelper {
1216
1225
  addPlatforms(
1217
1226
  platforms: string[],
1218
1227
  projectData: IProjectData,
1219
- frameworkPath?: string
1228
+ frameworkPath?: string,
1229
+ nativeHost?: string
1220
1230
  ): Promise<void>;
1221
1231
  cleanPlatforms(
1222
1232
  platforms: string[],
@@ -118,6 +118,7 @@ interface ICheckEnvironmentRequirementsOutput {
118
118
 
119
119
  interface IAddPlatformData extends IControllerDataBase {
120
120
  frameworkPath?: string;
121
+ nativeHost?: string;
121
122
  }
122
123
 
123
124
  interface IPlatformController {
@@ -16,11 +16,12 @@ const _ = require("lodash");
16
16
  const constants = require("../constants");
17
17
  const yok_1 = require("../common/yok");
18
18
  class PlatformCommandHelper {
19
- constructor($platformController, $fs, $errors, $logger, $mobileHelper, $packageInstallationManager, $pacoteService, $platformsDataService, $platformValidationService, $projectChangesService, $projectDataService, $tempService) {
19
+ constructor($platformController, $fs, $errors, $logger, $options, $mobileHelper, $packageInstallationManager, $pacoteService, $platformsDataService, $platformValidationService, $projectChangesService, $projectDataService, $tempService) {
20
20
  this.$platformController = $platformController;
21
21
  this.$fs = $fs;
22
22
  this.$errors = $errors;
23
23
  this.$logger = $logger;
24
+ this.$options = $options;
24
25
  this.$mobileHelper = $mobileHelper;
25
26
  this.$packageInstallationManager = $packageInstallationManager;
26
27
  this.$pacoteService = $pacoteService;
@@ -30,8 +31,12 @@ class PlatformCommandHelper {
30
31
  this.$projectDataService = $projectDataService;
31
32
  this.$tempService = $tempService;
32
33
  }
33
- addPlatforms(platforms, projectData, frameworkPath) {
34
+ addPlatforms(platforms, projectData, frameworkPath, nativeHost) {
34
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ if (this.$options.nativeHost) {
37
+ this.$logger.info("Ignoring platform add becuase of --native-host flag");
38
+ return;
39
+ }
35
40
  const platformsDir = projectData.platformsDir;
36
41
  this.$fs.ensureDirectoryExists(platformsDir);
37
42
  for (const platform of platforms) {
@@ -45,6 +50,7 @@ class PlatformCommandHelper {
45
50
  projectDir: projectData.projectDir,
46
51
  platform,
47
52
  frameworkPath,
53
+ nativeHost,
48
54
  });
49
55
  }
50
56
  });
@@ -61,6 +67,10 @@ class PlatformCommandHelper {
61
67
  }
62
68
  removePlatforms(platforms, projectData) {
63
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ if (this.$options.nativeHost) {
71
+ this.$logger.info("Ignoring platform remove becuase of --native-host flag");
72
+ return;
73
+ }
64
74
  for (const platform of platforms) {
65
75
  this.$platformValidationService.validatePlatformInstalled(platform, projectData);
66
76
  const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
@@ -72,7 +82,9 @@ class PlatformCommandHelper {
72
82
  errorMessage = err.message;
73
83
  }
74
84
  try {
75
- const platformDir = path.join(projectData.platformsDir, platform.toLowerCase());
85
+ const platformDir = this.$options.nativeHost
86
+ ? this.$options.nativeHost
87
+ : path.join(projectData.platformsDir, platform.toLowerCase());
76
88
  this.$fs.deleteDirectory(platformDir);
77
89
  yield this.$packageInstallationManager.uninstall(platformData.frameworkPackageName, projectData.projectDir);
78
90
  this.$logger.info(`Platform ${platform} successfully removed.`);
package/lib/options.js CHANGED
@@ -15,6 +15,7 @@ const yargs = require("yargs");
15
15
  const helpers_1 = require("yargs/helpers");
16
16
  const _ = require("lodash");
17
17
  const yok_1 = require("./common/yok");
18
+ const constants_1 = require("./constants");
18
19
  class Options {
19
20
  setupOptions(commandSpecificDashedOptions) {
20
21
  if (commandSpecificDashedOptions) {
@@ -206,6 +207,12 @@ class Options {
206
207
  },
207
208
  gradlePath: { type: "string", hasSensitiveValue: false },
208
209
  gradleArgs: { type: "string", hasSensitiveValue: false },
210
+ nativeHost: { type: "string", hasSensitiveValue: false },
211
+ nativeHostModule: {
212
+ type: "string",
213
+ hasSensitiveValue: false,
214
+ default: constants_1.APP_FOLDER_NAME,
215
+ },
209
216
  aab: { type: "boolean", hasSensitiveValue: false },
210
217
  performance: { type: "object", hasSensitiveValue: true },
211
218
  appleApplicationSpecificPassword: {
@@ -23,7 +23,7 @@ class ProjectFilesProvider extends project_files_provider_base_1.ProjectFilesPro
23
23
  }
24
24
  else {
25
25
  relativePath = path.relative(projectData.appDirectoryPath, parsedFilePath);
26
- mappedFilePath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, relativePath);
26
+ mappedFilePath = path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule, relativePath);
27
27
  }
28
28
  const appResourcesDirectoryPath = projectData.appResourcesDirectoryPath;
29
29
  const platformSpecificAppResourcesDirectoryPath = path.join(appResourcesDirectoryPath, platformData.normalizedPlatformName);
@@ -14,7 +14,8 @@ const path = require("path");
14
14
  const constants_1 = require("../../common/constants");
15
15
  const yok_1 = require("../../common/yok");
16
16
  class GradleBuildArgsService {
17
- constructor($hooksService, $analyticsService, $staticConfig, $projectData, $logger) {
17
+ constructor($androidToolsInfo, $hooksService, $analyticsService, $staticConfig, $projectData, $logger) {
18
+ this.$androidToolsInfo = $androidToolsInfo;
18
19
  this.$hooksService = $hooksService;
19
20
  this.$analyticsService = $analyticsService;
20
21
  this.$staticConfig = $staticConfig;
@@ -41,8 +42,11 @@ class GradleBuildArgsService {
41
42
  }
42
43
  getBaseTaskArgs(buildData) {
43
44
  const args = this.getBuildLoggingArgs();
45
+ const toolsInfo = this.$androidToolsInfo.getToolsInfo({
46
+ projectDir: buildData.projectDir,
47
+ });
44
48
  this.$projectData.initializeProjectData(buildData.projectDir);
45
- args.push(`-PappPath=${this.$projectData.getAppDirectoryPath()}`, `-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`);
49
+ args.push(`-PcompileSdk=android-${toolsInfo.compileSdkVersion}`, `-PtargetSdk=${toolsInfo.targetSdkVersion}`, `-PbuildToolsVersion=${toolsInfo.buildToolsVersion}`, `-PgenerateTypings=${toolsInfo.generateTypings}`, `-PappPath=${this.$projectData.getAppDirectoryPath()}`, `-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`);
46
50
  if (buildData.gradleArgs) {
47
51
  args.push(buildData.gradleArgs);
48
52
  }
@@ -23,7 +23,11 @@ class GradleCommandService {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  const { message, cwd, stdio, spawnOptions } = options;
25
25
  this.$logger.info(message);
26
- const childProcessOptions = { cwd, stdio: stdio || "inherit" };
26
+ const childProcessOptions = {
27
+ cwd,
28
+ stdio: stdio || "inherit",
29
+ shell: this.$hostInfo.isWindows,
30
+ };
27
31
  const gradleExecutable = (_a = options.gradlePath) !== null && _a !== void 0 ? _a : (this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew");
28
32
  const result = yield this.executeCommandSafe(gradleExecutable, gradleArgs, childProcessOptions, spawnOptions);
29
33
  return result;
@@ -23,14 +23,17 @@ const xml2js_1 = require("xml2js");
23
23
  const yok_1 = require("../common/yok");
24
24
  const _ = require("lodash");
25
25
  const resolve_package_path_1 = require("@rigor789/resolve-package-path");
26
+ const process_1 = require("process");
26
27
  class AndroidPluginBuildService {
27
28
  get $platformsDataService() {
28
29
  return this.$injector.resolve("platformsDataService");
29
30
  }
30
- constructor($fs, $childProcess, $hostInfo, $logger, $packageManager, $projectData, $projectDataService, $devicePlatformsConstants, $errors, $filesHashService, $hooksService, $injector, $watchIgnoreListService) {
31
+ constructor($fs, $childProcess, $hostInfo, $options, $androidToolsInfo, $logger, $packageManager, $projectData, $projectDataService, $devicePlatformsConstants, $errors, $filesHashService, $hooksService, $injector, $watchIgnoreListService) {
31
32
  this.$fs = $fs;
32
33
  this.$childProcess = $childProcess;
33
34
  this.$hostInfo = $hostInfo;
35
+ this.$options = $options;
36
+ this.$androidToolsInfo = $androidToolsInfo;
34
37
  this.$logger = $logger;
35
38
  this.$packageManager = $packageManager;
36
39
  this.$projectData = $projectData;
@@ -258,17 +261,6 @@ class AndroidPluginBuildService {
258
261
  this.replaceGradleAndroidPluginVersion(buildGradlePath, runtimeGradleVersions.gradleAndroidPluginVersion);
259
262
  this.replaceFileContent(buildGradlePath, "{{pluginName}}", pluginName);
260
263
  this.replaceFileContent(settingsGradlePath, "{{pluginName}}", pluginName);
261
- const shortPluginName = (0, helpers_1.getShortPluginName)(pluginName);
262
- const manifestPath = path.join(pluginTempDir, "src", "main", "AndroidManifest.xml");
263
- const manifestContent = this.$fs.readText(manifestPath);
264
- let packageName = `org.nativescript.${shortPluginName}`;
265
- const xml = yield this.getXml(manifestContent);
266
- if (xml["manifest"]) {
267
- if (xml["manifest"]["$"]["package"]) {
268
- packageName = xml["manifest"]["$"]["package"];
269
- }
270
- }
271
- this.replaceFileContent(buildGradlePath, "{{pluginNamespace}}", packageName);
272
264
  });
273
265
  }
274
266
  getRuntimeGradleVersions(projectDir) {
@@ -453,12 +445,25 @@ class AndroidPluginBuildService {
453
445
  buildPlugin(pluginBuildSettings) {
454
446
  var _a;
455
447
  return __awaiter(this, void 0, void 0, function* () {
448
+ if (!pluginBuildSettings.androidToolsInfo) {
449
+ this.$androidToolsInfo.validateInfo({
450
+ showWarningsAsErrors: true,
451
+ validateTargetSdk: true,
452
+ projectDir: pluginBuildSettings.projectDir,
453
+ });
454
+ pluginBuildSettings.androidToolsInfo =
455
+ this.$androidToolsInfo.getToolsInfo({
456
+ projectDir: pluginBuildSettings.projectDir,
457
+ });
458
+ }
456
459
  const gradlew = (_a = pluginBuildSettings.gradlePath) !== null && _a !== void 0 ? _a : (this.$hostInfo.isWindows ? "gradlew.bat" : "./gradlew");
457
460
  const localArgs = [
458
461
  "-p",
459
462
  pluginBuildSettings.pluginDir,
460
463
  "assembleRelease",
461
464
  `-PtempBuild=true`,
465
+ `-PcompileSdk=android-${pluginBuildSettings.androidToolsInfo.compileSdkVersion}`,
466
+ `-PbuildToolsVersion=${pluginBuildSettings.androidToolsInfo.buildToolsVersion}`,
462
467
  `-PappPath=${this.$projectData.getAppDirectoryPath()}`,
463
468
  `-PappResourcesPath=${this.$projectData.getAppResourcesDirectoryPath()}`,
464
469
  ];
@@ -468,11 +473,16 @@ class AndroidPluginBuildService {
468
473
  if (this.$logger.getLevel() === "INFO") {
469
474
  localArgs.push("--quiet");
470
475
  }
476
+ const opts = {
477
+ cwd: pluginBuildSettings.pluginDir,
478
+ stdio: "inherit",
479
+ shell: this.$hostInfo.isWindows,
480
+ };
481
+ if (this.$options.nativeHost) {
482
+ opts.env = Object.assign({ USER_PROJECT_PLATFORMS_ANDROID: path.resolve((0, process_1.cwd)(), this.$options.nativeHost) }, process.env);
483
+ }
471
484
  try {
472
- yield this.$childProcess.spawnFromEvent(gradlew, localArgs, "close", {
473
- cwd: pluginBuildSettings.pluginDir,
474
- stdio: "inherit",
475
- });
485
+ yield this.$childProcess.spawnFromEvent(gradlew, localArgs, "close", opts);
476
486
  }
477
487
  catch (err) {
478
488
  this.$errors.fail(`Failed to build plugin ${pluginBuildSettings.pluginName} : \n${err}`);
@@ -69,24 +69,26 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
69
69
  throw new Error("First call of getPlatformData without providing projectData.");
70
70
  }
71
71
  if (projectData && projectData.platformsDir) {
72
- const projectRoot = path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
72
+ const projectRoot = this.$options.nativeHost
73
+ ? this.$options.nativeHost
74
+ : path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
73
75
  const appDestinationDirectoryArr = [
74
76
  projectRoot,
75
- constants.APP_FOLDER_NAME,
77
+ this.$options.nativeHostModule,
76
78
  constants.SRC_DIR,
77
79
  constants.MAIN_DIR,
78
80
  constants.ASSETS_DIR,
79
81
  ];
80
82
  const configurationsDirectoryArr = [
81
83
  projectRoot,
82
- constants.APP_FOLDER_NAME,
84
+ this.$options.nativeHostModule,
83
85
  constants.SRC_DIR,
84
86
  constants.MAIN_DIR,
85
87
  constants.MANIFEST_FILE_NAME,
86
88
  ];
87
89
  const deviceBuildOutputArr = [
88
90
  projectRoot,
89
- constants.APP_FOLDER_NAME,
91
+ this.$options.nativeHostModule,
90
92
  constants.BUILD_DIR,
91
93
  constants.OUTPUTS_DIR,
92
94
  constants.APK_DIR,
@@ -102,7 +104,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
102
104
  projectRoot: projectRoot,
103
105
  getBuildOutputPath: (buildOptions) => {
104
106
  if (buildOptions.androidBundle) {
105
- return path.join(projectRoot, constants.APP_FOLDER_NAME, constants.BUILD_DIR, constants.OUTPUTS_DIR, constants.BUNDLE_DIR);
107
+ return path.join(projectRoot, this.$options.nativeHostModule, constants.BUILD_DIR, constants.OUTPUTS_DIR, constants.BUNDLE_DIR);
106
108
  }
107
109
  return path.join(...deviceBuildOutputArr);
108
110
  },
@@ -113,8 +115,8 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
113
115
  if (buildOptions.androidBundle) {
114
116
  return {
115
117
  packageNames: [
116
- `${constants.APP_FOLDER_NAME}${constants.AAB_EXTENSION_NAME}`,
117
- `${constants.APP_FOLDER_NAME}-${buildMode}${constants.AAB_EXTENSION_NAME}`,
118
+ `${this.$options.nativeHostModule}${constants.AAB_EXTENSION_NAME}`,
119
+ `${this.$options.nativeHostModule}-${buildMode}${constants.AAB_EXTENSION_NAME}`,
118
120
  ],
119
121
  };
120
122
  }
@@ -123,10 +125,10 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
123
125
  `${packageName}-${buildMode}${constants.APK_EXTENSION_NAME}`,
124
126
  `${projectData.projectName}-${buildMode}${constants.APK_EXTENSION_NAME}`,
125
127
  `${projectData.projectName}${constants.APK_EXTENSION_NAME}`,
126
- `${constants.APP_FOLDER_NAME}-${buildMode}${constants.APK_EXTENSION_NAME}`,
128
+ `${this.$options.nativeHostModule}-${buildMode}${constants.APK_EXTENSION_NAME}`,
127
129
  ],
128
130
  regexes: [
129
- new RegExp(`(${packageName}|${constants.APP_FOLDER_NAME})-.*-(${constants_1.Configurations.Debug}|${constants_1.Configurations.Release})(-unsigned)?${constants.APK_EXTENSION_NAME}`, "i"),
131
+ new RegExp(`(${packageName}|${this.$options.nativeHostModule})-.*-(${constants_1.Configurations.Debug}|${constants_1.Configurations.Release})(-unsigned)?${constants.APK_EXTENSION_NAME}`, "i"),
130
132
  ],
131
133
  };
132
134
  },
@@ -247,8 +249,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
247
249
  });
248
250
  }
249
251
  interpolateConfigurationFile(projectData) {
250
- const manifestPath = this.getPlatformData(projectData)
251
- .configurationFilePath;
252
+ const manifestPath = this.getPlatformData(projectData).configurationFilePath;
252
253
  shell.sed("-i", /__PACKAGE__/, projectData.projectIdentifiers.android, manifestPath);
253
254
  }
254
255
  getProjectNameFromId(projectData) {
@@ -290,7 +291,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
290
291
  });
291
292
  }
292
293
  isPlatformPrepared(projectRoot, projectData) {
293
- return this.$fs.exists(path.join(this.getPlatformData(projectData).appDestinationDirectoryPath, constants.APP_FOLDER_NAME));
294
+ return this.$fs.exists(path.join(this.getPlatformData(projectData).appDestinationDirectoryPath, this.$options.nativeHostModule));
294
295
  }
295
296
  getFrameworkFilesExtensions() {
296
297
  return [".jar", ".dat"];
@@ -391,7 +392,9 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
391
392
  return _.values(depsDictionary);
392
393
  }
393
394
  provideDependenciesJson(projectData, dependencies) {
394
- const platformDir = path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
395
+ const platformDir = this.$options.nativeHost
396
+ ? this.$options.nativeHost
397
+ : path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
395
398
  const dependenciesJsonPath = path.join(platformDir, constants.DEPENDENCIES_JSON_NAME);
396
399
  let nativeDependencyData = dependencies.filter(AndroidProjectService.isNativeAndroidDependency);
397
400
  let nativeDependencies = nativeDependencyData.map(({ name, directory, dependencies }) => {
@@ -471,7 +474,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
471
474
  }
472
475
  getLegacyAppResourcesDestinationDirPath(projectData) {
473
476
  const resourcePath = [
474
- constants.APP_FOLDER_NAME,
477
+ this.$options.nativeHostModule,
475
478
  constants.SRC_DIR,
476
479
  constants.MAIN_DIR,
477
480
  constants.RESOURCES_DIR,
@@ -480,7 +483,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
480
483
  }
481
484
  getUpdatedAppResourcesDestinationDirPath(projectData) {
482
485
  const resourcePath = [
483
- constants.APP_FOLDER_NAME,
486
+ this.$options.nativeHostModule,
484
487
  constants.SRC_DIR,
485
488
  ];
486
489
  return path.join(this.getPlatformData(projectData).projectRoot, ...resourcePath);
@@ -30,13 +30,17 @@ class AssetsGenerationService {
30
30
  splash: ["splashBackgrounds", "splashCenterImages", "splashImages"],
31
31
  };
32
32
  }
33
- constructor($logger, $projectDataService, $fs) {
33
+ constructor($logger, $projectDataService, $fs, $options) {
34
34
  this.$logger = $logger;
35
35
  this.$projectDataService = $projectDataService;
36
36
  this.$fs = $fs;
37
+ this.$options = $options;
37
38
  }
38
39
  generateIcons(resourceGenerationData) {
39
40
  return __awaiter(this, void 0, void 0, function* () {
41
+ if (this.$options.nativeHost) {
42
+ return;
43
+ }
40
44
  this.$logger.info("Generating icons ...");
41
45
  yield this.generateImagesForDefinitions(resourceGenerationData, this.propertiesToEnumerate.icon);
42
46
  this.$logger.info("Icons generation completed.");
@@ -44,6 +48,9 @@ class AssetsGenerationService {
44
48
  }
45
49
  generateSplashScreens(splashesGenerationData) {
46
50
  return __awaiter(this, void 0, void 0, function* () {
51
+ if (this.$options.nativeHost) {
52
+ return;
53
+ }
47
54
  this.$logger.info("Generating splash screens ...");
48
55
  yield this.generateImagesForDefinitions(splashesGenerationData, this.propertiesToEnumerate.splash);
49
56
  this.$logger.info("Splash screens generation completed.");
@@ -17,9 +17,10 @@ const path = require("path");
17
17
  const _ = require("lodash");
18
18
  const yok_1 = require("../common/yok");
19
19
  class FilesHashService {
20
- constructor($fs, $logger) {
20
+ constructor($fs, $logger, $options) {
21
21
  this.$fs = $fs;
22
22
  this.$logger = $logger;
23
+ this.$options = $options;
23
24
  }
24
25
  generateHashes(files) {
25
26
  return __awaiter(this, void 0, void 0, function* () {
@@ -41,7 +42,7 @@ class FilesHashService {
41
42
  }
42
43
  generateHashesForProject(platformData) {
43
44
  return __awaiter(this, void 0, void 0, function* () {
44
- const appFilesPath = path.join(platformData.appDestinationDirectoryPath, constants_2.APP_FOLDER_NAME);
45
+ const appFilesPath = path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule);
45
46
  const files = this.$fs.enumerateFilesInDirectorySync(appFilesPath);
46
47
  const hashes = yield this.generateHashes(files);
47
48
  return hashes;
@@ -90,7 +90,9 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
90
90
  projectData.platformsDir &&
91
91
  this._platformsDirCache !== projectData.platformsDir) {
92
92
  const platform = this.$mobileHelper.normalizePlatformName((_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : this.$devicePlatformsConstants.iOS);
93
- const projectRoot = path.join(projectData.platformsDir, platform.toLowerCase());
93
+ const projectRoot = this.$options.nativeHost
94
+ ? this.$options.nativeHost
95
+ : path.join(projectData.platformsDir, platform.toLowerCase());
94
96
  const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, platform.toLowerCase());
95
97
  this._platformData = {
96
98
  frameworkPackageName: runtimePackage.name,
@@ -328,7 +330,9 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
328
330
  }
329
331
  prepareProject(projectData, prepareData) {
330
332
  return __awaiter(this, void 0, void 0, function* () {
331
- const projectRoot = path.join(projectData.platformsDir, "ios");
333
+ const projectRoot = this.$options.nativeHost
334
+ ? this.$options.nativeHost
335
+ : path.join(projectData.platformsDir, this.$devicePlatformsConstants.iOS.toLowerCase());
332
336
  const platformData = this.getPlatformData(projectData);
333
337
  const pluginsData = this.getAllProductionPlugins(projectData);
334
338
  const pbxProjPath = this.getPbxProjPath(projectData);
@@ -345,7 +349,16 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
345
349
  }
346
350
  const project = this.createPbxProj(projectData);
347
351
  const resources = project.pbxGroupByName("Resources");
348
- if (resources) {
352
+ if (this.$options.nativeHost) {
353
+ try {
354
+ project.addResourceFile(path.join(this.$options.nativeHost, projectData.projectName));
355
+ this.savePbxProj(project, projectData);
356
+ }
357
+ catch (err) {
358
+ console.log(err);
359
+ }
360
+ }
361
+ if (resources && !this.$options.nativeHost) {
349
362
  const references = project.pbxFileReferenceSection();
350
363
  const xcodeProjectImages = _.map(resources.children, (resource) => this.replace(references[resource.value].name));
351
364
  this.$logger.trace("Images from Xcode project");
@@ -493,6 +506,13 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
493
506
  return frameworkPath;
494
507
  }
495
508
  getPbxProjPath(projectData) {
509
+ if (this.$options.nativeHost) {
510
+ let xcodeProjectPath = this.$xcprojService.findXcodeProject(this.$options.nativeHost);
511
+ if (!xcodeProjectPath) {
512
+ this.$errors.fail("Xcode project not found at the specified directory");
513
+ }
514
+ return path.join(xcodeProjectPath, "project.pbxproj");
515
+ }
496
516
  return path.join(this.$xcprojService.getXcodeprojPath(projectData, this.getPlatformData(projectData).projectRoot), "project.pbxproj");
497
517
  }
498
518
  createPbxProj(projectData) {
@@ -11,8 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AndroidDeviceSocketsLiveSyncService = void 0;
13
13
  const android_device_livesync_service_base_1 = require("./android-device-livesync-service-base");
14
- const constants_1 = require("../../constants");
15
- const constants_2 = require("../../common/constants");
14
+ const constants_1 = require("../../common/constants");
16
15
  const android_livesync_tool_1 = require("./android-livesync-tool");
17
16
  const path = require("path");
18
17
  const semver = require("semver");
@@ -57,7 +56,7 @@ class AndroidDeviceSocketsLiveSyncService extends android_device_livesync_servic
57
56
  });
58
57
  }
59
58
  getPathToLiveSyncFileOnDevice(appIdentifier) {
60
- return `${constants_2.LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appIdentifier}-livesync-in-progress`;
59
+ return `${constants_1.LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appIdentifier}-livesync-in-progress`;
61
60
  }
62
61
  finalizeSync(liveSyncInfo, projectData) {
63
62
  return __awaiter(this, void 0, void 0, function* () {
@@ -181,7 +180,7 @@ class AndroidDeviceSocketsLiveSyncService extends android_device_livesync_servic
181
180
  connectLivesyncTool(appIdentifier, connectTimeout) {
182
181
  return __awaiter(this, void 0, void 0, function* () {
183
182
  const platformData = this.platformsDataService.getPlatformData(this.$devicePlatformsConstants.Android, this.data);
184
- const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, constants_1.APP_FOLDER_NAME);
183
+ const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule);
185
184
  if (!this.livesyncTool.hasConnection()) {
186
185
  yield this.livesyncTool.connect({
187
186
  appIdentifier,
@@ -24,8 +24,8 @@ const semver = require("semver");
24
24
  const _ = require("lodash");
25
25
  const yok_1 = require("../../common/yok");
26
26
  class AndroidLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSyncServiceBase {
27
- constructor($platformsDataService, $projectFilesManager, $injector, $devicePathProvider, $fs, $logger) {
28
- super($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider);
27
+ constructor($platformsDataService, $projectFilesManager, $injector, $devicePathProvider, $fs, $logger, $options) {
28
+ super($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider, $options);
29
29
  this.$platformsDataService = $platformsDataService;
30
30
  this.$projectFilesManager = $projectFilesManager;
31
31
  this.$injector = $injector;
@@ -23,8 +23,8 @@ const constants_1 = require("../../constants");
23
23
  const decorators_1 = require("../../common/decorators");
24
24
  const yok_1 = require("../../common/yok");
25
25
  class IOSLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSyncServiceBase {
26
- constructor($fs, $platformsDataService, $projectFilesManager, $injector, $tempService, $devicePathProvider, $logger) {
27
- super($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider);
26
+ constructor($fs, $platformsDataService, $projectFilesManager, $injector, $tempService, $devicePathProvider, $logger, $options) {
27
+ super($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider, $options);
28
28
  this.$fs = $fs;
29
29
  this.$platformsDataService = $platformsDataService;
30
30
  this.$projectFilesManager = $projectFilesManager;
@@ -24,12 +24,13 @@ const helpers_1 = require("../../common/helpers");
24
24
  const decorators_1 = require("../../common/decorators");
25
25
  const color_1 = require("../../color");
26
26
  class PlatformLiveSyncServiceBase {
27
- constructor($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider) {
27
+ constructor($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider, $options) {
28
28
  this.$fs = $fs;
29
29
  this.$logger = $logger;
30
30
  this.$platformsDataService = $platformsDataService;
31
31
  this.$projectFilesManager = $projectFilesManager;
32
32
  this.$devicePathProvider = $devicePathProvider;
33
+ this.$options = $options;
33
34
  this._deviceLiveSyncServicesCache = {};
34
35
  }
35
36
  getDeviceLiveSyncService(device, projectData) {
@@ -81,7 +82,7 @@ class PlatformLiveSyncServiceBase {
81
82
  if (deviceLiveSyncService.beforeLiveSyncAction) {
82
83
  yield deviceLiveSyncService.beforeLiveSyncAction(deviceAppData);
83
84
  }
84
- const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, constants_1.APP_FOLDER_NAME);
85
+ const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule);
85
86
  const localToDevicePaths = yield this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, projectFilesPath, null, []);
86
87
  const modifiedFilesData = yield this.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, projectData, syncInfo.liveSyncDeviceData, { isFullSync: true, force: syncInfo.force });
87
88
  return {
@@ -112,7 +113,7 @@ class PlatformLiveSyncServiceBase {
112
113
  }
113
114
  if (existingFiles.length) {
114
115
  const platformData = this.$platformsDataService.getPlatformData(device.deviceInfo.platform, projectData);
115
- const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, constants_1.APP_FOLDER_NAME);
116
+ const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule);
116
117
  const localToDevicePaths = yield this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, projectFilesPath, existingFiles, []);
117
118
  modifiedLocalToDevicePaths.push(...localToDevicePaths);
118
119
  modifiedLocalToDevicePaths = yield this.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, projectData, liveSyncInfo.liveSyncDeviceData, { isFullSync: false, force: liveSyncInfo.force });
@@ -23,10 +23,11 @@ class LogSourceMapService {
23
23
  get $platformsDataService() {
24
24
  return this.$injector.resolve("platformsDataService");
25
25
  }
26
- constructor($fs, $projectDataService, $injector, $devicePlatformsConstants, $logger) {
26
+ constructor($fs, $projectDataService, $injector, $options, $devicePlatformsConstants, $logger) {
27
27
  this.$fs = $fs;
28
28
  this.$projectDataService = $projectDataService;
29
29
  this.$injector = $injector;
30
+ this.$options = $options;
30
31
  this.$devicePlatformsConstants = $devicePlatformsConstants;
31
32
  this.$logger = $logger;
32
33
  this.cache = {};
@@ -121,7 +122,7 @@ class LogSourceMapService {
121
122
  return runtimeVersion;
122
123
  }
123
124
  getOriginalFileLocation(platform, parsedLine, projectData) {
124
- const fileLocation = path.join(this.getFilesLocation(platform, projectData), constants_1.APP_FOLDER_NAME);
125
+ const fileLocation = path.join(this.getFilesLocation(platform, projectData), this.$options.nativeHostModule);
125
126
  if (parsedLine && parsedLine.filePath) {
126
127
  const sourceMapFile = path.join(fileLocation, parsedLine.filePath);
127
128
  const smc = this.cache[sourceMapFile];
@@ -21,13 +21,17 @@ const constants_1 = require("../../constants");
21
21
  const decorators_1 = require("../../common/decorators");
22
22
  const yok_1 = require("../../common/yok");
23
23
  class AddPlatformService {
24
- constructor($fs, $logger, $packageManager, $terminalSpinnerService, $analyticsService) {
24
+ constructor($fs, $logger, $options, $packageManager, $terminalSpinnerService, $analyticsService) {
25
25
  this.$fs = $fs;
26
26
  this.$logger = $logger;
27
+ this.$options = $options;
27
28
  this.$packageManager = $packageManager;
28
29
  this.$terminalSpinnerService = $terminalSpinnerService;
29
30
  this.$analyticsService = $analyticsService;
30
31
  }
32
+ addProjectHost() {
33
+ return __awaiter(this, void 0, void 0, function* () { });
34
+ }
31
35
  addPlatformSafe(projectData, platformData, packageToInstall, addPlatformData) {
32
36
  return __awaiter(this, void 0, void 0, function* () {
33
37
  const spinner = this.$terminalSpinnerService.createSpinner();
@@ -95,7 +99,9 @@ class AddPlatformService {
95
99
  }
96
100
  addNativePlatform(platformData, projectData, frameworkDirPath, frameworkVersion) {
97
101
  return __awaiter(this, void 0, void 0, function* () {
98
- const platformDir = path.join(projectData.platformsDir, platformData.normalizedPlatformName.toLowerCase());
102
+ const platformDir = this.$options.nativeHost
103
+ ? this.$options.nativeHost
104
+ : path.join(projectData.platformsDir, platformData.normalizedPlatformName.toLowerCase());
99
105
  this.$fs.deleteDirectory(platformDir);
100
106
  yield platformData.platformProjectService.createProject(path.resolve(frameworkDirPath), frameworkVersion, projectData);
101
107
  platformData.platformProjectService.ensureConfigurationFileInAppResources(projectData);
@@ -20,11 +20,12 @@ const helpers_1 = require("../../common/helpers");
20
20
  const decorators_1 = require("../../common/decorators");
21
21
  const yok_1 = require("../../common/yok");
22
22
  class PrepareNativePlatformService {
23
- constructor($hooksService, $nodeModulesBuilder, $projectChangesService, $metadataFilteringService) {
23
+ constructor($hooksService, $nodeModulesBuilder, $projectChangesService, $metadataFilteringService, $options) {
24
24
  this.$hooksService = $hooksService;
25
25
  this.$nodeModulesBuilder = $nodeModulesBuilder;
26
26
  this.$projectChangesService = $projectChangesService;
27
27
  this.$metadataFilteringService = $metadataFilteringService;
28
+ this.$options = $options;
28
29
  }
29
30
  prepareNativePlatform(platformData, projectData, prepareData) {
30
31
  return __awaiter(this, void 0, void 0, function* () {
@@ -40,8 +41,10 @@ class PrepareNativePlatformService {
40
41
  if (changesInfo.hasChanges) {
41
42
  yield this.cleanProject(platformData, { release });
42
43
  }
43
- platformData.platformProjectService.prepareAppResources(projectData);
44
- if (hasChangesRequirePrepare) {
44
+ if (!this.$options.nativeHost) {
45
+ platformData.platformProjectService.prepareAppResources(projectData);
46
+ }
47
+ if (hasChangesRequirePrepare || this.$options.nativeHost) {
45
48
  yield platformData.platformProjectService.prepareProject(projectData, prepareData);
46
49
  }
47
50
  if (hasNativeModulesChange) {
@@ -74,7 +74,9 @@ class PlatformEnvironmentRequirements {
74
74
  win32: "windows",
75
75
  darwin: "macos",
76
76
  }[process.platform];
77
- const anchor = platform ? `#setting-up-${os}-for-${platform.toLowerCase()}` : "";
77
+ const anchor = platform
78
+ ? `#setting-up-${os}-for-${platform.toLowerCase()}`
79
+ : "";
78
80
  return (`Verify that your environment is configured according to the system requirements described at\n` +
79
81
  `https://docs.nativescript.org/setup/${os}${anchor}.`);
80
82
  }
@@ -412,7 +412,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
412
412
  const isPlatformInstalled = this.$fs.exists(path.join(projectData.platformsDir, platform.toLowerCase()));
413
413
  if (isPlatformInstalled) {
414
414
  const platformData = this.$platformsDataService.getPlatformData(platform.toLowerCase(), projectData);
415
- const pluginDestinationPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, "tns_modules");
415
+ const pluginDestinationPath = path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule, "tns_modules");
416
416
  yield action(pluginDestinationPath, platform.toLowerCase(), platformData);
417
417
  }
418
418
  }
@@ -450,6 +450,9 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
450
450
  });
451
451
  }
452
452
  getAllPluginsNativeHashes(pathToPluginsBuildFile) {
453
+ if (this.$options.nativeHost) {
454
+ return {};
455
+ }
453
456
  let data = {};
454
457
  if (this.$fs.exists(pathToPluginsBuildFile)) {
455
458
  data = this.$fs.readJson(pathToPluginsBuildFile);
@@ -457,6 +460,9 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
457
460
  return data;
458
461
  }
459
462
  setPluginNativeHashes(opts) {
463
+ if (this.$options.nativeHost) {
464
+ return;
465
+ }
460
466
  opts.allPluginsNativeHashes[opts.pluginData.name] =
461
467
  opts.currentPluginNativeHashes;
462
468
  this.$fs.writeJson(opts.pathToPluginsBuildFile, opts.allPluginsNativeHashes);
@@ -37,10 +37,11 @@ class ProjectChangesInfo {
37
37
  }
38
38
  }
39
39
  class ProjectChangesService {
40
- constructor($devicePlatformsConstants, $fs, $logger, $hooksService, $nodeModulesDependenciesBuilder) {
40
+ constructor($devicePlatformsConstants, $fs, $logger, $options, $hooksService, $nodeModulesDependenciesBuilder) {
41
41
  this.$devicePlatformsConstants = $devicePlatformsConstants;
42
42
  this.$fs = $fs;
43
43
  this.$logger = $logger;
44
+ this.$options = $options;
44
45
  this.$hooksService = $hooksService;
45
46
  this.$nodeModulesDependenciesBuilder = $nodeModulesDependenciesBuilder;
46
47
  }
@@ -130,6 +131,9 @@ class ProjectChangesService {
130
131
  return prepareInfoFilePath;
131
132
  }
132
133
  getPrepareInfo(platformData) {
134
+ if (this.$options.nativeHost) {
135
+ return null;
136
+ }
133
137
  const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
134
138
  let prepareInfo = null;
135
139
  if (this.$fs.exists(prepareInfoFilePath)) {
@@ -147,6 +151,9 @@ class ProjectChangesService {
147
151
  if (!this._prepareInfo) {
148
152
  yield this.ensurePrepareInfo(platformData, projectData, prepareData);
149
153
  }
154
+ if (this.$options.nativeHost) {
155
+ return null;
156
+ }
150
157
  const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
151
158
  this.$fs.writeJson(prepareInfoFilePath, this._prepareInfo);
152
159
  });
@@ -94,8 +94,8 @@ class WebpackCompilerService extends events_1.EventEmitter {
94
94
  hash: "",
95
95
  };
96
96
  }
97
- const files = result.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, "app", file));
98
- const fallbackFiles = result.fallbackFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, "app", file));
97
+ const files = result.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule, file));
98
+ const fallbackFiles = result.fallbackFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule, file));
99
99
  const data = {
100
100
  files,
101
101
  hasOnlyHotUpdateFiles: files.every((f) => f.indexOf("hot-update") > -1),
@@ -214,10 +214,18 @@ class WebpackCompilerService extends events_1.EventEmitter {
214
214
  args.push("--watch");
215
215
  }
216
216
  const stdio = prepareData.watch ? ["ipc"] : "inherit";
217
- const childProcess = this.$childProcess.spawn(process.execPath, args, {
217
+ const options = {
218
218
  cwd: projectData.projectDir,
219
219
  stdio,
220
- });
220
+ };
221
+ if (this.$options.nativeHost) {
222
+ options.env = {
223
+ USER_PROJECT_PLATFORMS_ANDROID: this.$options.nativeHost,
224
+ USER_PROJECT_PLATFORMS_ANDROID_MODULE: this.$options.nativeHostModule,
225
+ USER_PROJECT_PLATFORMS_IOS: this.$options.nativeHost,
226
+ };
227
+ }
228
+ const childProcess = this.$childProcess.spawn(process.execPath, args, options);
221
229
  this.webpackProcesses[platformData.platformNameLowerCase] = childProcess;
222
230
  yield this.$cleanupService.addKillProcess(childProcess.pid.toString());
223
231
  return childProcess;
@@ -337,8 +345,8 @@ class WebpackCompilerService extends events_1.EventEmitter {
337
345
  return;
338
346
  }
339
347
  this.$logger.trace("Webpack build done!");
340
- const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, "app", asset));
341
- const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, "app", asset));
348
+ const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule, asset));
349
+ const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.nativeHostModule, asset));
342
350
  const lastHash = (() => {
343
351
  const absoluteFileNameWithLastHash = files.find((fileName) => fileName.endsWith("hot-update.js"));
344
352
  if (!absoluteFileNameWithLastHash) {
@@ -1,11 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path = require("path");
4
+ const fs = require("fs");
4
5
  const constants_1 = require("../constants");
5
6
  const yok_1 = require("../common/yok");
6
7
  class XcprojService {
7
8
  getXcodeprojPath(projectData, projectRoot) {
8
9
  return path.join(projectRoot, projectData.projectName + constants_1.IosProjectConstants.XcodeProjExtName);
9
10
  }
11
+ findXcodeProject(dir) {
12
+ const filesAndDirs = fs.readdirSync(dir);
13
+ for (let i = 0; i < filesAndDirs.length; i++) {
14
+ const fullPath = path.join(dir, filesAndDirs[i]);
15
+ if (fs.statSync(fullPath).isDirectory() &&
16
+ filesAndDirs[i].endsWith(".xcodeproj")) {
17
+ return fullPath;
18
+ }
19
+ }
20
+ return null;
21
+ }
10
22
  }
11
23
  yok_1.injector.register("xcprojService", XcprojService);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nativescript",
3
- "preferGlobal": true,
4
- "version": "8.8.0-alpha.0",
3
+ "main": "./lib/nativescript-cli-lib.js",
4
+ "version": "8.8.0-embed.0",
5
5
  "author": "NativeScript <support@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {
@@ -10,7 +10,6 @@
10
10
  "nsc": "./bin/tns",
11
11
  "ns": "./bin/tns"
12
12
  },
13
- "main": "./lib/nativescript-cli-lib.js",
14
13
  "files": [
15
14
  "bin/*",
16
15
  "config",
@@ -117,7 +116,6 @@
117
116
  "xml2js": "0.6.2",
118
117
  "yargs": "17.7.1"
119
118
  },
120
- "analyze": true,
121
119
  "devDependencies": {
122
120
  "@types/archiver": "^5.3.2",
123
121
  "@types/byline": "^4.2.33",
@@ -171,13 +169,6 @@
171
169
  "sinon": "15.0.3",
172
170
  "source-map-support": "0.5.21"
173
171
  },
174
- "license": "Apache-2.0",
175
- "engines": {
176
- "node": ">=10.0.0"
177
- },
178
- "lint-staged": {
179
- "*.ts": "prettier --write"
180
- },
181
172
  "bundleDependencies_comment1": "These dependencies are bundled in the CLI and are not installed from npm to avoid deprecation warnings.",
182
173
  "bundleDependencies_comment2": "Eventually we'll remove them as we replaced their functionality.",
183
174
  "bundleDependencies_comment3": "note: @npmcli/move-file is a transient dep of pacote - we dont use it directly.",
@@ -185,6 +176,9 @@
185
176
  "@npmcli/move-file",
186
177
  "stringify-package"
187
178
  ],
179
+ "optionalDependencies": {
180
+ "fsevents": "*"
181
+ },
188
182
  "overrides": {
189
183
  "jimp": {
190
184
  "xml2js": "0.6.2"
@@ -192,5 +186,13 @@
192
186
  "npm-watch": {
193
187
  "nodemon": "3.0.3"
194
188
  }
189
+ },
190
+ "analyze": true,
191
+ "license": "Apache-2.0",
192
+ "engines": {
193
+ "node": ">=14.0.0"
194
+ },
195
+ "lint-staged": {
196
+ "*.ts": "prettier --write"
195
197
  }
196
- }
198
+ }
@@ -1 +1 @@
1
- Downloaded from https://github.com/google/bundletool/releases/tag/1.15.6
1
+ Downloaded from https://github.com/google/bundletool/releases/tag/1.8.2
Binary file
@@ -8,14 +8,33 @@ apply plugin: 'kotlin-android'
8
8
  apply plugin: 'kotlin-parcelize'
9
9
 
10
10
  buildscript {
11
+ // project.ext.USER_PROJECT_ROOT = "$rootDir/../../.."
12
+ project.ext.PLATFORMS_ANDROID = "platforms/android"
13
+ project.ext.PLUGIN_NAME = "{{pluginName}}"
14
+
15
+ def USER_PROJECT_ROOT_FROM_ENV = System.getenv('USER_PROJECT_ROOT');
16
+ if (USER_PROJECT_ROOT_FROM_ENV != null && !USER_PROJECT_ROOT_FROM_ENV.equals("")) {
17
+ project.ext.USER_PROJECT_ROOT = USER_PROJECT_ROOT_FROM_ENV;
18
+ } else {
19
+ project.ext.USER_PROJECT_ROOT = "$rootDir/../../../"
20
+ }
21
+
22
+ def USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV = System.getenv('USER_PROJECT_PLATFORMS_ANDROID');
23
+ if (USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV != null && !USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV.equals("")) {
24
+ project.ext.USER_PROJECT_PLATFORMS_ANDROID = USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV;
25
+ } else {
26
+ project.ext.USER_PROJECT_PLATFORMS_ANDROID = project.ext.USER_PROJECT_ROOT + PLATFORMS_ANDROID
27
+ }
28
+
29
+
11
30
  def getDepPlatformDir = { dep ->
12
- file("${project.ext.USER_PROJECT_ROOT}/${project.ext.PLATFORMS_ANDROID}/${dep.directory}/$PLATFORMS_ANDROID")
31
+ file("${project.ext.USER_PROJECT_PLATFORMS_ANDROID}/${dep.directory}/$PLATFORMS_ANDROID")
13
32
  }
14
- def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "2.0.0-RC1" }
33
+ def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.8.20" }
15
34
  def kotlinVersion = computeKotlinVersion()
16
35
  repositories {
17
36
  google()
18
- mavenCentral()
37
+ jcenter()
19
38
  }
20
39
  dependencies {
21
40
  classpath 'com.android.tools.build:gradle:{{runtimeAndroidPluginVersion}}'
@@ -29,12 +48,8 @@ buildscript {
29
48
  project.ext.getDepPlatformDir = getDepPlatformDir
30
49
  project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
31
50
 
32
- project.ext.USER_PROJECT_ROOT = "$rootDir/../../.."
33
- project.ext.PLATFORMS_ANDROID = "platforms/android"
34
- project.ext.PLUGIN_NAME = "{{pluginName}}"
35
-
36
51
  // the build script will not work with previous versions of the CLI (3.1 or earlier)
37
- def dependenciesJson = file("${project.ext.USER_PROJECT_ROOT}/${project.ext.PLATFORMS_ANDROID}/dependencies.json")
52
+ def dependenciesJson = file("${project.ext.USER_PROJECT_PLATFORMS_ANDROID}/dependencies.json")
38
53
  def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
39
54
  def pluginData = appDependencies.find { it.name == project.ext.PLUGIN_NAME }
40
55
  project.ext.nativescriptDependencies = appDependencies.findAll{pluginData.dependencies.contains(it.name)}
@@ -135,6 +150,7 @@ allprojects {
135
150
  url 'https://maven.google.com/'
136
151
  name 'Google'
137
152
  }
153
+ jcenter()
138
154
  if (pluginDependencies.size() > 0) {
139
155
  flatDir {
140
156
  dirs pluginDependencies
@@ -144,29 +160,13 @@ allprojects {
144
160
  }
145
161
 
146
162
 
147
- def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 34 }
148
- def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 34 as int }
163
+ def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 31 }
164
+ def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 31 as int }
149
165
  def computeBuildToolsVersion = { ->
150
- project.hasProperty("buildToolsVersion") ? buildToolsVersion : "34.0.0"
166
+ project.hasProperty("buildToolsVersion") ? buildToolsVersion : "31.0.0"
151
167
  }
152
168
 
153
169
  android {
154
- namespace "{{pluginNamespace}}"
155
-
156
- kotlinOptions {
157
- jvmTarget = '17'
158
- }
159
-
160
- compileOptions {
161
- sourceCompatibility JavaVersion.VERSION_17
162
- targetCompatibility JavaVersion.VERSION_17
163
- }
164
-
165
-
166
- if (project.hasProperty("ndkVersion")) {
167
- ndkVersion project.ndkVersion
168
- }
169
-
170
170
  def applyPluginGradleConfigurations = { ->
171
171
  nativescriptDependencies.each { dep ->
172
172
  def includeGradlePath = "${getDepPlatformDir(dep)}/include.gradle"
@@ -220,6 +220,15 @@ task addDependenciesFromNativeScriptPlugins {
220
220
  }
221
221
  }
222
222
 
223
+ afterEvaluate {
224
+ def generateBuildConfig = project.hasProperty("generateBuildConfig") ? project.generateBuildConfig : false
225
+ def generateR = project.hasProperty("generateR") ? project.generateR : false
226
+ generateReleaseBuildConfig.enabled = generateBuildConfig
227
+ generateDebugBuildConfig.enabled = generateBuildConfig
228
+ generateReleaseResValues.enabled = generateR
229
+ generateDebugResValues.enabled = generateR
230
+ }
231
+
223
232
  tasks.whenTaskAdded({ DefaultTask currentTask ->
224
233
  if (currentTask.name == 'bundleRelease' || currentTask.name == 'bundleDebug') {
225
234
  def generateBuildConfig = project.hasProperty("generateBuildConfig") ? project.generateBuildConfig : false
@@ -1,16 +1,26 @@
1
1
  import groovy.json.JsonSlurper
2
2
 
3
- def USER_PROJECT_ROOT = "$rootDir/../../../"
3
+ // def USER_PROJECT_ROOT = "$rootDir/../../../"
4
4
  def PLATFORMS_ANDROID = "platforms/android"
5
5
  def PLUGIN_NAME = "{{pluginName}}"
6
6
 
7
- def dependenciesJson = file("${USER_PROJECT_ROOT}/${PLATFORMS_ANDROID}/dependencies.json")
7
+ def USER_PROJECT_PLATFORMS_ANDROID
8
+ def USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV = System.getenv('USER_PROJECT_PLATFORMS_ANDROID');
9
+ if (USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV != null && !USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV.equals("")) {
10
+ USER_PROJECT_PLATFORMS_ANDROID = USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV;
11
+ } else {
12
+ USER_PROJECT_PLATFORMS_ANDROID = "$rootDir/../../../platforms/android"
13
+ }
14
+
15
+ System.out.println("!!!!! VM: USER_PROJECT_PLATFORMS_ANDROID: " + USER_PROJECT_PLATFORMS_ANDROID);
16
+
17
+ def dependenciesJson = file("${USER_PROJECT_PLATFORMS_ANDROID}/dependencies.json")
8
18
  def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
9
19
  def pluginData = appDependencies.find { it.name == PLUGIN_NAME }
10
20
  def nativescriptDependencies = appDependencies.findAll{pluginData.name == it.name}
11
21
 
12
22
  def getDepPlatformDir = { dep ->
13
- file("$USER_PROJECT_ROOT/$PLATFORMS_ANDROID/${dep.directory}/$PLATFORMS_ANDROID")
23
+ file("$USER_PROJECT_PLATFORMS_ANDROID/${dep.directory}/$PLATFORMS_ANDROID")
14
24
  }
15
25
 
16
26
  def applyIncludeSettingsGradlePlugin = {
@@ -1,15 +0,0 @@
1
- # Changers Lorgs!
2
-
3
- ## 1.0
4
-
5
- Full rewrite. Essentially a brand new module.
6
-
7
- - Return a promise instead of taking a callback.
8
- - Use native `fs.mkdir(path, { recursive: true })` when available.
9
- - Drop support for outdated Node.js versions. (Technically still works on
10
- Node.js v8, but only 10 and above are officially supported.)
11
-
12
- ## 0.x
13
-
14
- Original and most widely used recursive directory creation implementation
15
- in JavaScript, dating back to 2010.
@@ -1,65 +0,0 @@
1
- # v3.0
2
-
3
- - Add `--preserve-root` option to executable (default true)
4
- - Drop support for Node.js below version 6
5
-
6
- # v2.7
7
-
8
- - Make `glob` an optional dependency
9
-
10
- # 2.6
11
-
12
- - Retry on EBUSY on non-windows platforms as well
13
- - Make `rimraf.sync` 10000% more reliable on Windows
14
-
15
- # 2.5
16
-
17
- - Handle Windows EPERM when lstat-ing read-only dirs
18
- - Add glob option to pass options to glob
19
-
20
- # 2.4
21
-
22
- - Add EPERM to delay/retry loop
23
- - Add `disableGlob` option
24
-
25
- # 2.3
26
-
27
- - Make maxBusyTries and emfileWait configurable
28
- - Handle weird SunOS unlink-dir issue
29
- - Glob the CLI arg for better Windows support
30
-
31
- # 2.2
32
-
33
- - Handle ENOENT properly on Windows
34
- - Allow overriding fs methods
35
- - Treat EPERM as indicative of non-empty dir
36
- - Remove optional graceful-fs dep
37
- - Consistently return null error instead of undefined on success
38
- - win32: Treat ENOTEMPTY the same as EBUSY
39
- - Add `rimraf` binary
40
-
41
- # 2.1
42
-
43
- - Fix SunOS error code for a non-empty directory
44
- - Try rmdir before readdir
45
- - Treat EISDIR like EPERM
46
- - Remove chmod
47
- - Remove lstat polyfill, node 0.7 is not supported
48
-
49
- # 2.0
50
-
51
- - Fix myGid call to check process.getgid
52
- - Simplify the EBUSY backoff logic.
53
- - Use fs.lstat in node >= 0.7.9
54
- - Remove gently option
55
- - remove fiber implementation
56
- - Delete files that are marked read-only
57
-
58
- # 1.0
59
-
60
- - Allow ENOENT in sync method
61
- - Throw when no callback is provided
62
- - Make opts.gently an absolute path
63
- - use 'stat' if 'lstat' is not available
64
- - Consistent error naming, and rethrow non-ENOENT stat errors
65
- - add fiber implementation
@@ -1,16 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- <a name="1.0.1"></a>
6
- ## [1.0.1](https://github.com/npm/stringify-package/compare/v1.0.0...v1.0.1) (2019-09-30)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * strict comparison ([0c5675f](https://github.com/npm/stringify-package/commit/0c5675f)), closes [#2](https://github.com/npm/stringify-package/issues/2)
12
-
13
-
14
-
15
- <a name="1.0.0"></a>
16
- # 1.0.0 (2018-07-18)