Skip to content

Commit 66158aa

Browse files
committed
chore: delete plugin variables service
1 parent 7fb1752 commit 66158aa

10 files changed

+0
-650
lines changed

lib/common/declarations.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,11 +1242,6 @@ interface IResourceLoader {
12421242
readJson(path: string): any;
12431243
}
12441244

1245-
interface IPluginVariablesHelper {
1246-
getPluginVariableFromVarOption(variableName: string, configuration?: string): any;
1247-
simplifyYargsObject(obj: any, configuration?: string): any;
1248-
}
1249-
12501245
/**
12511246
* Used for getting strings for informational/error messages.
12521247
*/

lib/common/plugin-variables-helper.ts

Lines changed: 0 additions & 90 deletions
This file was deleted.

lib/definitions/plugins.d.ts

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,6 @@ interface IPluginPlatformsData {
4444
android: string;
4545
}
4646

47-
interface IPluginVariablesService {
48-
/**
49-
* Saves plugin variables in project package.json file.
50-
* @param {IPluginData} pluginData for the plugin.
51-
* @param {string} projectDir: Specifies the directory of the project.
52-
* @return {Promise<void>}
53-
*/
54-
savePluginVariablesInProjectFile(pluginData: IPluginData, projectDir: string): Promise<void>;
55-
56-
/**
57-
* Removes plugin variables from project package.json file.
58-
* @param {string} pluginName Name of the plugin.
59-
* @param {string} projectDir: Specifies the directory of the project.
60-
* @return {void}
61-
*/
62-
removePluginVariablesFromProjectFile(pluginName: string, projectDir: string): void;
63-
64-
/**
65-
* Replaces all plugin variables with their corresponding values.
66-
* @param {IPluginData} pluginData for the plugin.
67-
* @param {pluginConfigurationFilePath} pluginConfigurationFilePath for the plugin.
68-
* @param {string} projectDir: Specifies the directory of the project.
69-
* @return {Promise<void>}
70-
*/
71-
interpolatePluginVariables(pluginData: IPluginData, pluginConfigurationFilePath: string, projectDir: string): Promise<void>;
72-
73-
/**
74-
* Replaces {nativescript.id} expression with the application identifier from package.json.
75-
* @param {pluginConfigurationFilePath} pluginConfigurationFilePath for the plugin.
76-
* @return {void}
77-
*/
78-
interpolateAppIdentifier(pluginConfigurationFilePath: string, projectIdentifier: string): void;
79-
80-
/**
81-
* Replaces both plugin variables and appIdentifier
82-
*/
83-
interpolate(pluginData: IPluginData, pluginConfigurationFilePath: string, projectDir: string, projectIdentifier: string): Promise<void>;
84-
85-
/**
86-
* Returns the
87-
* @param {string} pluginName for the plugin.
88-
* @return {Promise<string>} returns the changed plugin configuration file content.
89-
*/
90-
getPluginVariablePropertyName(pluginName: string): string;
91-
92-
}
93-
9447
interface IPluginVariableData {
9548
defaultValue?: string;
9649
name?: string;

lib/services/android-project-service.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
2626
private $logger: ILogger,
2727
$projectDataService: IProjectDataService,
2828
private $injector: IInjector,
29-
private $pluginVariablesService: IPluginVariablesService,
3029
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
3130
private $packageManager: INodePackageManager,
3231
private $androidPluginBuildService: IAndroidPluginBuildService,
@@ -545,12 +544,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
545544
const resourcesDestinationDirectoryPath = path.join(this.getPlatformData(projectData).projectRoot, constants.SRC_DIR, flattenedDependencyName);
546545
this.$fs.ensureDirectoryExists(resourcesDestinationDirectoryPath);
547546
shell.cp("-Rf", path.join(pluginPlatformsFolderPath, "*"), resourcesDestinationDirectoryPath);
548-
549-
const filesForInterpolation = this.$fs.enumerateFilesInDirectorySync(resourcesDestinationDirectoryPath, file => this.$fs.getFsStats(file).isDirectory() || path.extname(file) === constants.XML_FILE_EXTENSION) || [];
550-
for (const file of filesForInterpolation) {
551-
this.$logger.trace(`Interpolate data for plugin file: ${file}`);
552-
await this.$pluginVariablesService.interpolate(pluginData, file, projectData.projectDir, projectData.projectIdentifiers.android);
553-
}
554547
}
555548

556549
// Copy include.gradle file

lib/services/ios-project-service.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
4343
private $devicesService: Mobile.IDevicesService,
4444
private $mobileHelper: Mobile.IMobileHelper,
4545
private $hostInfo: IHostInfo,
46-
private $pluginVariablesService: IPluginVariablesService,
4746
private $xcprojService: IXcprojService,
4847
private $iOSProvisionService: IOSProvisionService,
4948
private $pbxprojDomXcode: IPbxprojDomXcode,
@@ -800,11 +799,6 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
800799
await this.mergeInfoPlists(projectData, opts);
801800
await this.$iOSEntitlementsService.merge(projectData);
802801
await this.mergeProjectXcconfigFiles(projectData, opts);
803-
for (const pluginData of await this.getAllInstalledPlugins(projectData)) {
804-
await this.$pluginVariablesService.interpolatePluginVariables(pluginData, this.getPlatformData(projectData).configurationFilePath, projectData.projectDir);
805-
}
806-
807-
this.$pluginVariablesService.interpolateAppIdentifier(this.getPlatformData(projectData).configurationFilePath, projectData.projectIdentifiers.ios);
808802
}
809803

810804
private getInfoPlistPath(projectData: IProjectData): string {

lib/services/plugin-variables-service.ts

Lines changed: 0 additions & 104 deletions
This file was deleted.

lib/services/plugins-service.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ export class PluginsService implements IPluginsService {
1212
private get $platformsData(): IPlatformsData {
1313
return this.$injector.resolve("platformsData");
1414
}
15-
private get $pluginVariablesService(): IPluginVariablesService {
16-
return this.$injector.resolve("pluginVariablesService");
17-
}
1815
private get $projectDataService(): IProjectDataService {
1916
return this.$injector.resolve("projectDataService");
2017
}
@@ -57,16 +54,6 @@ export class PluginsService implements IPluginsService {
5754

5855
await this.executeForAllInstalledPlatforms(action, projectData);
5956

60-
try {
61-
await this.$pluginVariablesService.savePluginVariablesInProjectFile(pluginData, projectData.projectDir);
62-
} catch (err) {
63-
// Revert package.json
64-
this.$projectDataService.removeNSProperty(projectData.projectDir, this.$pluginVariablesService.getPluginVariablePropertyName(pluginData.name));
65-
await this.$packageManager.uninstall(plugin, PluginsService.NPM_CONFIG, projectData.projectDir);
66-
67-
throw err;
68-
}
69-
7057
this.$logger.out(`Successfully installed plugin ${realNpmPackageJson.name}.`);
7158
} else {
7259
await this.$packageManager.uninstall(realNpmPackageJson.name, { save: true }, projectData.projectDir);
@@ -81,7 +68,6 @@ export class PluginsService implements IPluginsService {
8168
await platformData.platformProjectService.removePluginNativeCode(pluginData, projectData);
8269
};
8370

84-
this.$pluginVariablesService.removePluginVariablesFromProjectFile(pluginName.toLowerCase(), projectData.projectDir);
8571
await this.executeForAllInstalledPlatforms(removePluginNativeCodeAction, projectData);
8672

8773
await this.executeNpmCommand(PluginsService.UNINSTALL_COMMAND_NAME, pluginName, projectData);

test/ios-project-service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import { LoggingLevels } from "../lib/common/mobile/logging-levels";
2121
import { DeviceDiscovery } from "../lib/common/mobile/mobile-core/device-discovery";
2222
import { IOSDeviceDiscovery } from "../lib/common/mobile/mobile-core/ios-device-discovery";
2323
import { AndroidDeviceDiscovery } from "../lib/common/mobile/mobile-core/android-device-discovery";
24-
import { PluginVariablesService } from "../lib/services/plugin-variables-service";
25-
import { PluginVariablesHelper } from "../lib/common/plugin-variables-helper";
2624
import { Utils } from "../lib/common/utils";
2725
import { CocoaPodsService } from "../lib/services/cocoapods-service";
2826
import { PackageManager } from "../lib/package-manager";
@@ -113,8 +111,6 @@ function createTestInjector(projectPath: string, projectName: string, xCode?: IX
113111
checkIfXcodeprojIsRequired: () => ({})
114112
});
115113
testInjector.register("iosDeviceOperations", {});
116-
testInjector.register("pluginVariablesService", PluginVariablesService);
117-
testInjector.register("pluginVariablesHelper", PluginVariablesHelper);
118114
testInjector.register("pluginsService", {
119115
getAllInstalledPlugins: (): string[] => []
120116
});

0 commit comments

Comments
 (0)