From b6c9176d83d64fa86e48c438ae83531ca14b4a21 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 2 Dec 2015 17:49:15 +0200 Subject: [PATCH] Add baseConfig option Add baseConfig option that can be used to replace the default AndroidManifest.xml / Info.plist that is used for merge. It should be passed to all build related commands. It can be passed to platform add command as well. --- lib/declarations.ts | 1 + lib/options.ts | 1 + lib/services/platform-service.ts | 5 +++++ lib/services/plugins-service.ts | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/declarations.ts b/lib/declarations.ts index 9c90f22085..2024836824 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -87,6 +87,7 @@ interface IOptions extends ICommonOptions { compileSdk: number; port: Number; copyTo: string; + baseConfig: string; } interface IProjectFilesManager { diff --git a/lib/options.ts b/lib/options.ts index ce2c032d26..431e4cf6f4 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -34,6 +34,7 @@ export class Options extends commonOptionsLibPath.OptionsBase { compileSdk: {type: OptionType.Number }, port: { type: OptionType.Number }, copyTo: { type: OptionType.String }, + baseConfig: { type: OptionType.String } }, path.join($hostInfo.isWindows ? process.env.LocalAppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"), $errors, $staticConfig); diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index a114fc2564..91dd4853a0 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -113,6 +113,11 @@ export class PlatformService implements IPlatformService { let sourceFrameworkDir = isFrameworkPathDirectory && this.$options.symlink ? path.join(this.$options.frameworkPath, "framework") : frameworkDir; platformData.platformProjectService.createProject(path.resolve(sourceFrameworkDir), installedVersion).wait(); + if(this.$options.baseConfig) { + let newConfigFile = path.resolve(this.$options.baseConfig); + this.$logger.trace(`Replacing '${platformData.configurationFilePath}' with '${newConfigFile}'.`); + this.$fs.copyFile(newConfigFile, platformData.configurationFilePath).wait(); + } if(isFrameworkPathDirectory || isFrameworkPathNotSymlinkedFile) { // Need to remove unneeded node_modules folder diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index 781b455d22..813ca640ea 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -114,7 +114,7 @@ export class PluginsService implements IPluginsService { npmInstallationManager.addToCache(platformData.frameworkPackageName, frameworkVersion).wait(); let cachedPackagePath = npmInstallationManager.getCachedPackagePath(platformData.frameworkPackageName, frameworkVersion); - let cachedConfigurationFilePath = path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, platformData.relativeToFrameworkConfigurationFilePath); + let cachedConfigurationFilePath = this.$options.baseConfig ? path.resolve(this.$options.baseConfig) : path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, platformData.relativeToFrameworkConfigurationFilePath); let cachedConfigurationFileContent = this.$fs.readText(cachedConfigurationFilePath).wait(); this.$fs.writeFile(platformData.configurationFilePath, cachedConfigurationFileContent).wait();