eclipse/plugins: support multiple plugins JARs

+23 -11
+23 -11
pkgs/applications/editors/eclipse/plugins.nix
··· 20 20 21 21 # Helper for the common case where we have separate feature and 22 22 # plugin JARs. 23 - buildEclipsePlugin = { name, srcFeature, srcPlugin, ... } @ attrs: 24 - buildEclipsePluginBase (attrs // { 25 - srcs = [ srcFeature srcPlugin ]; 23 + buildEclipsePlugin = 24 + { name, srcFeature, srcPlugin ? null, srcPlugins ? [], ... } @ attrs: 25 + assert srcPlugin == null -> srcPlugins != []; 26 + assert srcPlugin != null -> srcPlugins == []; 26 27 27 - buildCommand = '' 28 - dropinDir="$out/eclipse/dropins/${name}" 28 + let 29 29 30 - mkdir -p $dropinDir/features 31 - unzip ${srcFeature} -d $dropinDir/features/ 30 + pSrcs = if (srcPlugin != null) then [ srcPlugin ] else srcPlugins; 32 31 33 - mkdir -p $dropinDir/plugins 34 - cp -v ${srcPlugin} $dropinDir/plugins/${name}.jar 35 - ''; 36 - }); 32 + in 33 + 34 + buildEclipsePluginBase (attrs // { 35 + srcs = [ srcFeature ] ++ pSrcs; 36 + 37 + buildCommand = '' 38 + dropinDir="$out/eclipse/dropins/${name}" 39 + 40 + mkdir -p $dropinDir/features 41 + unzip ${srcFeature} -d $dropinDir/features/ 42 + 43 + mkdir -p $dropinDir/plugins 44 + for plugin in ${toString pSrcs}; do 45 + cp -v $plugin $dropinDir/plugins/$(stripHash $plugin) 46 + done 47 + ''; 48 + }); 37 49 38 50 # Helper for the case where the build directory has the layout of an 39 51 # Eclipse update site, that is, it contains the directories