eclipse.plugins: unpack plugins when required

Some plugin bundles must be unpacked when used in Eclipse. With this
change the plugin manifest is checked for the setting indicating that
unpacking should happen.
This commit is contained in:
Robert Helgesson 2015-08-01 15:16:17 +02:00 committed by Bjørn Forsman
parent 7d60bb48eb
commit 24a5d47883

View file

@ -49,16 +49,35 @@ rec {
installPhase = '' installPhase = ''
dropinDir="$out/eclipse/dropins/${name}" dropinDir="$out/eclipse/dropins/${name}"
# Install features.
cd features cd features
for feature in *.jar; do for feature in *.jar; do
feat=''${feature%.jar} featureName=''${feature%.jar}
mkdir -p $dropinDir/features/$feat mkdir -p $dropinDir/features/$featureName
unzip $feature -d $dropinDir/features/$feat unzip $feature -d $dropinDir/features/$featureName
done done
cd .. cd ..
# Install plugins.
mkdir -p $dropinDir/plugins mkdir -p $dropinDir/plugins
cp -v "plugins/"*.jar $dropinDir/plugins/
# A bundle should be unpacked if the manifest matches this
# pattern.
unpackPat="Eclipse-BundleShape:\\s*dir"
cd plugins
for plugin in *.jar ; do
pluginName=''${plugin%.jar}
manifest=$(unzip -p $plugin META-INF/MANIFEST.MF)
if [[ $manifest =~ $unpackPat ]] ; then
mkdir $dropinDir/plugins/$pluginName
unzip $plugin -d $dropinDir/plugins/$pluginName
else
cp -v $plugin $dropinDir/plugins/
fi
done
cd ..
''; '';
}); });