summaryrefslogtreecommitdiff
path: root/packager/build.xml
blob: 65c8401afffc95d58c11451e10617dd8c8d18545 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?xml version="1.0"?>
<!-- ======================================================================
 *
 * The Contents of this file are made available subject to the terms of
 * the GNU Lesser General Public License Version 2.1
 *
 * GNU Lesser General Public License Version 2.1
 * =============================================
 * Copyright 2009 by Cédric Bosdonnat.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 * 
 * The Initial Developer of the Original Code is: Cédric Bosdonnat.
 *
 * Copyright: 2009 by Cédric Bosdonnat.
 *
 * All Rights Reserved.
 * 
  ====================================================================== -->
<project name="packager" default="update-sources"> 
	
	<target name="init-env">
		<dirname property="packager.basedir" file="${ant.file.packager}"/>
		
		<property name="packager.git.repo" value="git://github.com/cbosdo/ooo-plugin-packager.git" />
		
		<property name="packager.out.path" value="${packager.basedir}/bin/ant" />
		<property name="packager.out.classes" value="${packager.out.path}/classes"/>
        <property name="packager.sources" value="${packager.basedir}/source"/>
		
		<mkdir dir="${packager.out.path}/features" />
		<mkdir dir="${packager.out.path}/plugins" />
        <mkdir dir="${packager.out.classes}" />

        <condition property="packager.sources.cloned">
        	<available file="${packager.sources}"/>
        </condition>
	</target>
	
	<target name="packager.version" depends="init-env">
		<property name="manifest.properties" value="MANIFEST-MF.properties"/>
		<copy tofile="${manifest.properties}" file="${packager.basedir}/META-INF/MANIFEST.MF"/>
		<replace file="${manifest.properties}" token=":" value="="/>
		<property file="${manifest.properties}" prefix="packager"/>
		<delete file="${manifest.properties}" />
	</target>
	
	<target name="packager.purge" depends="init-env">
		<property name="packager.out.path" value="${packager.basedir}/bin/ant" />
		<delete dir="${packager.out.path}" />
	</target>

    <target name="clone-sources" depends="init-env" unless="packager.sources.cloned">
        <exec executable="git" dir="${packager.basedir}">
            <arg line="clone ${packager.git.repo}"/>
            <arg line="source"/>
        </exec>
    </target>
    
    <target name="pull-sources" depends="init-env, clone-sources" if="packager.sources.cloned">
        <exec executable="git" dir="${packager.sources}">
            <arg line="pull -r"/>
        </exec>
    </target>
	
	<target name="update-sources" depends="clone-sources, pull-sources" description="Update the packager sources from git"/>
	
    <target name="packager-compile" depends="init-env, update-sources">
    	<javac srcdir="${packager.sources}/ooo-plugin-packager-core/src/main" destdir="${packager.out.classes}"
				target="1.5" source="1.5" 
				debug="${debug}"/>
    </target>


	<target name="packager.plugin" depends="packager.version, packager-compile">
		<jar destfile="${packager.out.path}/plugins/${package.prefix}.packager.core_${packager.Bundle-Version}.jar"
			manifest="${packager.basedir}/META-INF/MANIFEST.MF">
			<zipfileset prefix="" dir="${packager.sources}/ooo-plugin-packager-core/src/main">
				<exclude name="**/*.java"/>
			</zipfileset>
			<zipfileset prefix="" dir="${packager.out.classes}"/>
		</jar>
	</target>
	
    <target name="packager.site" depends="packager.plugin">

		<!-- Copying the plugins -->
		<copy todir="${out.path}/plugins">
            <fileset dir="${packager.out.path}/plugins/"
				includes="*.jar" />
			<mapper type="flatten" />
        </copy>

		<!-- Preparing the plugins for p2 update site -->
        <prepareJar jar="${out.path}/plugins/${package.prefix}.packager.core_${packager.Bundle-Version}.jar" outdir="${out.path}/plugins"/>
    </target>
	
</project>