summaryrefslogtreecommitdiff
path: root/javainstaller2/build.xml
blob: 4ad58dbea7ea7cd7057d915b3445acc7abb10420 (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
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0"?>
<!--***********************************************************
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 ***********************************************************-->


<project name="javainstaller2" default="build" basedir=".">

  <!-- build output directory -->
  <property name="name"                   value="JavaSetup"/>
  <property name="out"                    value="build"/>
  <property name="classes.dir"            value="classes"/>
  <property name="source.dir"             location="${basedir}/src/${name}"/>
  <property name="build.dir"              location="${out}/misc"/>
  <property name="dist.dir"               location="${out}/bin"/>
  <property name="compile.debug"          value="true"/>
  <property name="compile.optimize"       value="false"/>
  <property name="lib.dir"                location="{$basedir}/lib"/>
  <property name="verbose"                value="false"/>
  <property name="javainstaller.jar.file" location="{$basedir}/lib"/>

  <!-- MAIN TARGET -->
  <target name="build" depends="prepare, info_uptodate, info_notuptodate, compile-javainstaller, jar-javainstaller, clean">
    <echo message="Done"/>
  </target>

  <!-- INITIALIZATION TASKS -->
  <target name="init">
    <!-- up to date checks -->
    <uptodate property="jarFile.uptodate" targetfile="${dist.dir}/${name}.jar">
      <srcfiles dir="${source.dir}" includes="**/*.gif,**/*.png,**/*.java"/>
      <srcfiles dir="${build.dir}" includes="**/*.properties"/>
    </uptodate>
  </target>

  <target name="prepare" depends="init" unless="jarFile.uptodate">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.dir}/${classes.dir}"/>
    <mkdir dir="${build.dir}/${classes.dir}/${name}"/>
    <mkdir dir="${dist.dir}"/>
  </target>

  <!-- show information about current sub target in recursive builds -->
  <target name="info_uptodate" depends="init" if="jarFile.uptodate">
    <tstamp prefix="start"/>
    <echo message="--------------------------------------------------------------------------------" />
    <echo message="Nothing to do. ${dist.dir}/${name}.jar is up to date."/>
    <echo message="--------------------------------------------------------------------------------" />
  </target>

  <!-- show information about current sub target in recursive builds -->
  <target name="info_notuptodate" depends="init" unless="jarFile.uptodate">
    <tstamp prefix="start"/>
    <echo message="--------------------------------------------------------------------------------" />
    <echo message="Source dir: ${source.dir}"/>
    <echo message="Build dir: ${build.dir}"/>
    <echo message="Dist dir: ${dist.dir}"/>
    <echo message="Debug is ${debug}"/>
    <echo message="--------------------------------------------------------------------------------" />
  </target>

  <target name="compile-javainstaller" depends="prepare" unless="jarFile.uptodate">
    <javac  srcdir="${source.dir}" source="1.4" target="1.4"
            destdir="${build.dir}/${classes.dir}/${name}"
            debug="${compile.debug}"
            optimize="${compile.optimize}">
    </javac>
    <copy todir="${build.dir}/${classes.dir}/${name}/org/openoffice/setup">
      <fileset dir="${build.dir}" includes="*.properties"/>
    </copy>
    <copy todir="${build.dir}/${classes.dir}/${name}/org/openoffice/setup/Icons">
      <fileset dir="${source.dir}/org/openoffice/setup/Icons" includes="*.gif,*.png"/>
    </copy>
  </target>

  <target name="jar-javainstaller" depends="compile-javainstaller" unless="jarFile.uptodate">
    <jar file="${dist.dir}/${name}.jar">
        <fileset dir="${build.dir}/${classes.dir}/${name}" includes="**/*"/>
        <manifest>
          <attribute name="Main-Class" value="org.openoffice.setup.Main"/>
        </manifest>
    </jar>
  </target>

  <!-- CLEAN UP OUTPUT TREES -->
  <target name="clean" unless="jarFile.uptodate">
   <!-- <delete dir="${build.dir}"/> -->
  </target>

  <!-- execution section -->
  <target name="run" depends="jar-javainstaller">
    <echo message="Starting: java -jar ${dist.dir}/${name}.jar" />
    <java jar="${dist.dir}/${name}.jar" fork="true"/>
     <!-- </java> -->
  </target>

  <target name="debug" depends="jar-javainstaller">
    <echo message="Starting for debugging: java -jar ${dist.dir}/${name}.jar" />
    <java jar="${dist.dir}/${name}.jar" fork="true"/>
     <!-- </java> -->
</target>


</project>