summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2012-10-09 07:15:38 +0000
committerVaadin Code Review <review@vaadin.com>2012-10-09 07:15:38 +0000
commitb497019a356105abc6fee9552d1b1b2ebacf78c0 (patch)
tree835210a8e2ab23155be7933f22d56f3134d5787e
parent5060adb19b22435addbc34fcad6e7ca9e67c273c (diff)
parentcb7be61639ab59c2f35f645bb52da35b39631a09 (diff)
downloadvaadin-framework-b497019a356105abc6fee9552d1b1b2ebacf78c0.tar.gz
vaadin-framework-b497019a356105abc6fee9552d1b1b2ebacf78c0.zip
Merge "Refactor OSGi manifest attribute handling to support import/export better (#9793)"
-rw-r--r--build.properties1
-rw-r--r--common.xml86
2 files changed, 64 insertions, 23 deletions
diff --git a/build.properties b/build.properties
index fb08ef6690..548169c457 100644
--- a/build.properties
+++ b/build.properties
@@ -2,6 +2,7 @@ javadoc.doctitle=<h1>Vaadin</h1>
javadoc.bottom=<i>Copyright &#169; 2000-2011 Vaadin Ltd. All Rights Reserved.</i>
ivy.organisation=com.vaadin
vaadin.vendor=Vaadin Ltd
+vaadin.url=http://vaadin.com
vaadin.java.version=1.6
vaadin.version=0.0.0.unversioned-development-build
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">