/
build_dp.xml
47 lines (38 loc) · 1.93 KB
/
build_dp.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<project name="build-dp" default="build-dp" basedir="../../../../">
<target name="build-dp">
<echo message="Building DP in ${basedir}" />
<!-- Create the manifest -->
<echo file="${project.build.directory}/dp_stage/META-INF/MANIFEST.MF" append="false">Manifest-Version: 1.0
DeploymentPackage-SymbolicName: org.darugna.kura.weblog
DeploymentPackage-Version: 1.1.1
Name: bundles/org.darugna.kura.weblog_1.1.1.jar
Bundle-SymbolicName: org.darugna.kura.weblog;singleton:=true
Bundle-Version: 1.1.1
</echo>
<!-- move everything into place -->
<echo message="Copying org.darugna.kura.weblog" />
<copy file="${basedir}/../org.darugna.kura.weblog/target/org.darugna.kura.weblog_1.1.1.jar"
todir="${project.build.directory}/dp_stage/bundles/" />
<!-- Files MUST be included in the jar in the same order as they are declared in the DP MANIFEST.
I used alphabetical order. -->
<!-- https://ant.apache.org/manual/Tasks/jar.html -->
<local name="sortedFiles"/>
<pathconvert property="sortedFiles" pathsep="${line.separator}">
<sort>
<fileset dir="${project.build.directory}/dp_stage/" includes="bundles/*"/>
</sort>
</pathconvert>
<echo message="Generating DP with files:${line.separator}${sortedFiles}" />
<!-- http://stackoverflow.com/questions/6341285/ant-sort-files-in-generated-jar
https://github.com/apache/felix/blob/b2fbc90c5cbcba405c8392c70c808c02728f6dc1/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
-->
<!-- Do NOT include directory entries in the JAR, only the files.
First, the MANIFEST.
Then, bundles in the correct order -->
<jar destfile="${basedir}/../org.darugna.kura.weblog_1.1.1.dp"
manifest="${project.build.directory}/dp_stage/META-INF/MANIFEST.MF"
includes="" filesonly="true">
<filelist dir="${project.build.directory}/dp_stage/" files="${sortedFiles}"/>
</jar>
</target>
</project>