From 3a70f217385bbc2c0ab24ab14485b6752a35219a Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 18 Jan 2018 20:07:47 +0100 Subject: [PATCH] eclipse/plugins: support multiple plugins JARs --- pkgs/applications/editors/eclipse/plugins.nix | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/editors/eclipse/plugins.nix b/pkgs/applications/editors/eclipse/plugins.nix index f6ce395a6f16..cea3008d2c3e 100644 --- a/pkgs/applications/editors/eclipse/plugins.nix +++ b/pkgs/applications/editors/eclipse/plugins.nix @@ -20,20 +20,32 @@ rec { # Helper for the common case where we have separate feature and # plugin JARs. - buildEclipsePlugin = { name, srcFeature, srcPlugin, ... } @ attrs: - buildEclipsePluginBase (attrs // { - srcs = [ srcFeature srcPlugin ]; + buildEclipsePlugin = + { name, srcFeature, srcPlugin ? null, srcPlugins ? [], ... } @ attrs: + assert srcPlugin == null -> srcPlugins != []; + assert srcPlugin != null -> srcPlugins == []; - buildCommand = '' - dropinDir="$out/eclipse/dropins/${name}" + let - mkdir -p $dropinDir/features - unzip ${srcFeature} -d $dropinDir/features/ + pSrcs = if (srcPlugin != null) then [ srcPlugin ] else srcPlugins; - mkdir -p $dropinDir/plugins - cp -v ${srcPlugin} $dropinDir/plugins/${name}.jar - ''; - }); + in + + buildEclipsePluginBase (attrs // { + srcs = [ srcFeature ] ++ pSrcs; + + buildCommand = '' + dropinDir="$out/eclipse/dropins/${name}" + + mkdir -p $dropinDir/features + unzip ${srcFeature} -d $dropinDir/features/ + + mkdir -p $dropinDir/plugins + for plugin in ${toString pSrcs}; do + cp -v $plugin $dropinDir/plugins/$(stripHash $plugin) + done + ''; + }); # Helper for the case where the build directory has the layout of an # Eclipse update site, that is, it contains the directories