Skip to content

Commit 70574a5

Browse files
committed
refactor: resolve plugin names the same way
1 parent 657f6f4 commit 70574a5

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

lib/common

Submodule common updated 1 file

lib/services/android-plugin-build-service.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as path from "path";
22
import { MANIFEST_FILE_NAME, INCLUDE_GRADLE_NAME, ASSETS_DIR, RESOURCES_DIR } from "../constants";
3+
import { getShortPluginName } from "../common/helpers";
34
import { Builder, parseString } from "xml2js";
45
import { ILogger } from "log4js";
56

@@ -37,15 +38,6 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
3738
return this.$fs.exists(manifest) ? manifest : null;
3839
}
3940

40-
private getShortPluginName(pluginName: string): string {
41-
return this.sanitizePluginName(pluginName).replace(/[\-]/g, "_");
42-
}
43-
44-
private sanitizePluginName(pluginName: string): string {
45-
// avoid long plugin names, exclude the npm module scope (@scope/nativescript-plugin) from the android plugin name
46-
return pluginName.split("/").pop();
47-
}
48-
4941
private async updateManifestContent(oldManifestContent: string, defaultPackageName: string): Promise<string> {
5042
let xml: any = await this.getXml(oldManifestContent);
5143

@@ -169,7 +161,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
169161
// IDEA: apply app.gradle here in order to get any and all user-defined variables
170162
// IDEA: apply the entire include.gradle here instead of copying over the repositories {} and dependencies {} scopes
171163

172-
const shortPluginName = this.getShortPluginName(options.pluginName);
164+
const shortPluginName = getShortPluginName(options.pluginName);
173165
const newPluginDir = path.join(options.tempPluginDirPath, shortPluginName);
174166
const newPluginMainSrcDir = path.join(newPluginDir, "src", "main");
175167
const defaultPackageName = "org.nativescript." + shortPluginName;

0 commit comments

Comments
 (0)