diff --git a/lib/common b/lib/common index e76ec0935..d34a94aad 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit e76ec0935a45afb6b9d1f0bd2440163c4786c30c +Subproject commit d34a94aad0fd2892a8dc722d7c85791e58d0604f diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index 521696947..3ecf972d0 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -30,30 +30,12 @@ export class PluginsService implements IPluginsService { } public getInstalledPlugins(): IPlugin[] { - var corePlugins: any = null; - if(options.debug || options.d) { - corePlugins = this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "debug"); - } else if(options.release || options.r) { - corePlugins = this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "release"); - } else { - corePlugins = _.intersection(this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "debug"), this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "release")); - } - - return _.map(corePlugins, (pluginIdentifier: string) => this.identifierToPlugin[pluginIdentifier]); + return this.getAllInstalledPlugins({getPluginsWithoutOptions: _.intersection}); } // return plugins that are enabled in one or more configurations public getInstalledPluginsEnabledAtLeastInOneConfiguration(): IPlugin[] { - var corePlugins: any = null; - if(options.debug || options.d) { - corePlugins = this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "debug"); - } else if(options.release || options.r) { - corePlugins = this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "release"); - } else { - corePlugins = _.union(this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "debug"), this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "release")); - } - - return _.map(corePlugins, (pluginIdentifier: string) => this.identifierToPlugin[pluginIdentifier]); + return this.getAllInstalledPlugins({getPluginsWithoutOptions: _.union}); } public getAvailablePlugins(): IPlugin[] { @@ -257,5 +239,18 @@ export class PluginsService implements IPluginsService { return plugin; } + + private getAllInstalledPlugins(configuration: {operation: (...args: any[]) => any[]}): IPlugin[] { + var corePlugins: any = null; + if(options.debug || options.d) { + corePlugins = this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "debug"); + } else if(options.release || options.r) { + corePlugins = this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "release"); + } else { + corePlugins = configuration.operation(this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "debug"), this.$project.getProperty(PluginsService.CORE_PLUGINS_PROPERTY_NAME, "release")); + } + + return _.map(corePlugins, (pluginIdentifier: string) => this.identifierToPlugin[pluginIdentifier]); + } } -$injector.register("pluginsService", PluginsService); \ No newline at end of file +$injector.register("pluginsService", PluginsService);