blob: 55f87b72f52f75d6fe7698dbc06773467a8e2f44 [file] [log] [blame]
<!--
******************************************************************************
* Copyright (c) 2016 Oracle
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Konstantin Komissarchik - initial implementation and ongoing maintenance
******************************************************************************
-->
<project name="corundum.macro.for-each-plugin">
<macrodef name="for-each-plugin">
<attribute name="path"/>
<element name="loop-body-elements" implicit="yes"/>
<sequential>
<for param="plugin.path">
<path>
<dirset dir="@{path}" includes="*"/>
<fileset dir="@{path}" includes="*.jar"/>
</path>
<sequential>
<var name="plugin.path" value="@{plugin.path}"/>
<read-manifest path="@{plugin.path}">
<entry key="Bundle-SymbolicName" property="plugin.id"/>
<entry key="Bundle-Version" property="plugin.version"/>
</read-manifest>
<if>
<isset property="plugin.id"/>
<then>
<var name="plugin.id.trimmed" unset="true"/>
<propertyregex property="plugin.id.trimmed" input="${plugin.id}" regexp="([^;]*).*" select="\1"/>
<if>
<isset property="plugin.id.trimmed"/>
<then>
<var name="plugin.id" value="${plugin.id.trimmed}"/>
<var name="plugin.id.trimmed" unset="true"/>
</then>
</if>
<property name="plugin.manifest" value="${plugin.path}/META-INF/MANIFEST.MF"/>
<loop-body-elements/>
</then>
<else>
<echo message="Could not read plugin id for ${plugin.path}."/>
</else>
</if>
<var name="plugin.path" unset="true"/>
<var name="plugin.id" unset="true"/>
<var name="plugin.version" unset="true"/>
<var name="plugin.manifest" unset="true"/>
</sequential>
</for>
</sequential>
</macrodef>
</project>