summaryrefslogtreecommitdiffstats
path: root/common.xml
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-10-08 16:00:37 +0300
committerArtur Signell <artur@vaadin.com>2012-10-09 09:59:28 +0300
commitcb7be61639ab59c2f35f645bb52da35b39631a09 (patch)
tree4b1e84f2eae50cf1c18b55d077d050a382e7314d /common.xml
parentab6e73909a2ac5067facddbd2a8ac003bd3dba53 (diff)
downloadvaadin-framework-cb7be61639ab59c2f35f645bb52da35b39631a09.tar.gz
vaadin-framework-cb7be61639ab59c2f35f645bb52da35b39631a09.zip
Refactor OSGi manifest attribute handling to support import/export better (#9793)
Change-Id: Iae53213b40a688b27a4195fa25c998d3ba43cba3
Diffstat (limited to 'common.xml')
-rw-r--r--common.xml86
1 files changed, 63 insertions, 23 deletions
diff --git a/common.xml b/common.xml
index ffaf27b735..bd18e7d522 100644
--- a/common.xml
+++ b/common.xml
@@ -161,53 +161,84 @@
<property name="src" location="{$result.dir}/../src" />
<union id="jar.files">
- <fileset dir="${classes}" excludes="${classes.exclude}" />
- <fileset dir="${src}" excludes="${jar.exclude}" />
+ <fileset dir="${classes}" excludes="${classes.exclude}" erroronmissingdir="false" />
+ <fileset dir="${src}" excludes="${jar.exclude}" erroronmissingdir="false" />
<fileset refid="common.files.for.all.jars" />
<union refid="extra.jar.includes" />
</union>
+
<jar destfile="${result.jar}" duplicate="fail" index="true">
<manifest>
- <attribute name="Implementation-Vendor" value="Vaadin Ltd" />
- <attribute name="Implementation-URL" value="http://vaadin.com" />
+ <attribute name="Implementation-Vendor" value="${vaadin.vendor}" />
+ <attribute name="Implementation-URL" value="${vaadin.url}" />
<attribute name="Implementation-Version" value="${vaadin.version}" />
- <attribute name="Bundle-Version" value="${vaadin.version}" />
- <attribute name="Bundle-ManifestVersion" value="2" />
- <attribute name="Bundle-Name" value="${module.name}" />
- <attribute name="Bundle-SymbolicName" value="${module.symbolic}" />
- <attribute name="Bundle-Vendor" value="${vaadin.vendor}" />
- <attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-1.6" />
</manifest>
<union refid="jar.files" />
</jar>
- <antcall target="common.generate-osgi-exports">
+ <antcall target="common.make-osgi-bundle">
<param name="jar" value="${result.jar}" />
+ <param name="bundle-version" value="${vaadin.version}" />
+ <param name="bundle-name" value="${module.name}" />
+ <param name="bundle-symbolic" value="${module.symbolic}" />
+ <param name="bundle-vendor" value="${vaadin.vendor}" />
</antcall>
</target>
- <target name="generate-osgi-exports">
+ <!-- Add OSGi attributes to the manifest of the given jar -->
+ <target name="make-osgi-bundle">
<fail unless="jar" message="No jar parameter given" />
+ <fail unless="bundle-name" message="No bundle-name parameter given" />
+ <fail unless="bundle-symbolic" message="No bundle-symbolic parameter given" />
+ <fail unless="bundle-version" message="No bundle-version parameter given" />
+ <fail unless="bundle-vendor" message="No bundle-vendor parameter given" />
+
+ <property name="bundle-manifestversion" value="2" />
- <!-- Generate the Export-Package attribute in the manifest of the
- JAR -->
+ <jar file="${jar}" update="true">
+ <manifest>
+ <attribute name="Bundle-Version" value="${bundle-version}" />
+ <attribute name="Bundle-ManifestVersion" value="${bundle-manifestversion}" />
+ <attribute name="Bundle-Name" value="${bundle-name}" />
+ <attribute name="Bundle-SymbolicName" value="${bundle-symbolic}" />
+ <attribute name="Bundle-Vendor" value="${bundle-vendor}" />
+ <attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-${vaadin.java.version}" />
+ </manifest>
+ </jar>
+
+ <antcontrib:if>
+ <isset property="import-package" />
+ <then>
+ <jar file="${result.jar}" update="true">
+ <manifest>
+ <attribute name="Import-Package" value="${import-package}" />
+ </manifest>
+ </jar>
+ </then>
+ </antcontrib:if>
+ <antcontrib:if>
+ <isset property="export-package" />
+ <then>
+ <jar file="${result.jar}" update="true">
+ <manifest>
+ <attribute name="Export-Package" value="${export-package}" />
+ </manifest>
+ </jar>
+ </then>
+ </antcontrib:if>
+
+ <!-- Generate the Export-Package attribute in the manifest -->
<java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes">
<arg value="${jar}" />
<arg value="com/vaadin" />
<arg value="com/google" />
-
<classpath refid="vaadin.buildhelpers.classpath" />
</java>
</target>
- <target name="compile" description="Compiles the module" depends="dependencies">
+ <target name="compile" description="Compiles the module" depends="dependencies, directories" if="src-exists">
<fail unless="module.name" message="No module name given" />
- <property name="result.dir" location="result" />
- <property name="src" location="${result.dir}/../src" />
- <property name="classes" location="${result.dir}/classes" />
-
- <mkdir dir="${classes}" />
<javac srcdir="${src}" destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
<classpath refid="classpath.compile.dependencies" />
@@ -215,6 +246,14 @@
</javac>
</target>
+ <target name="directories">
+ <property name="result.dir" location="result" />
+ <property name="src" location="${result.dir}/../src" />
+ <property name="classes" location="${result.dir}/classes" />
+ <available file="${src}" type="dir" property="src-exists" />
+ <mkdir dir="${classes}" />
+ </target>
+
<target name="tests.run" depends="tests.compile">
<fail unless="module.name" message="No module name given" />
@@ -268,8 +307,9 @@
</target>
<target name="dependencies" description="Resolves dependencies needed by this module" depends="filter.webcontent">
- <ivy:resolve resolveid="common" conf="build, build-provided" />
- <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" />
+ <property name='conf' value="build, build-provided" />
+ <ivy:resolve resolveid="common" conf="${conf}" />
+ <ivy:cachepath pathid="classpath.compile.dependencies" conf="${conf}" />
</target>
<target name="dependencies.tests" description="Resolves dependencies needed by tests">