Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common
Submodule common updated 2 files
+0 −11 helpers.ts
+1 −1 options.ts
37 changes: 16 additions & 21 deletions lib/services/plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down Expand Up @@ -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);
$injector.register("pluginsService", PluginsService);