|
1 | 1 | <?xml version="1.0" ?>
|
2 |
| -<project name="FITServlet" default="war"> |
| 2 | +<project name="FITS Service" default="war"> |
3 | 3 |
|
4 | 4 | <!--
|
5 |
| - Compile classpath depends on finding an external fits.jar from FITS project. |
| 5 | + Compile classpath depends on finding an external fits.jar from the FITS project. |
6 | 6 | The environment variable "fits_jar_location" can be set to point to the
|
7 |
| - location containing fits.jar. Alternatively, set the value for property "fits.jar.fallback.location" |
8 |
| - in the following properties file. |
| 7 | + directory containing fits.jar (or some version JAR such as fits-1.0.0.jar). |
| 8 | + Alternatively, set the value for property "fits.jar.fallback.location" in the build.properties file. |
9 | 9 | -->
|
10 | 10 | <property file="build.properties" />
|
11 | 11 | <property environment="env"/> <!-- access to environment properties -->
|
|
28 | 28 | <property name="classes.dir" location="WebContent/WEB-INF/classes" />
|
29 | 29 | <property name="dist.dir" location="dist" />
|
30 | 30 |
|
31 |
| - <target name="init" depends="clean"> |
32 |
| - |
33 |
| - <!-- Location of possible FITS JAR file as set by environment variable. --> |
34 |
| - <fileset dir="${fits.jar.environment.location}" includes="*.jar" id="fits.jar.environment"> |
| 31 | + <target name="set-fits-jar-env-directory-exists"> |
| 32 | + <!-- Set property if the fits.jar fallback directory exists (before checking for JAR file). --> |
| 33 | + <condition property="fits.jar.environment.location.exists"> |
| 34 | + <available file="${env.fits_jar_location}" type="dir"/> |
| 35 | + </condition> |
| 36 | + </target> |
| 37 | + |
| 38 | + <target name="set-fits-jar-location-by-env" if="fits.jar.environment.location.exists" |
| 39 | + depends="set-fits-jar-env-directory-exists"> |
| 40 | + <!-- |
| 41 | + Sets the count of fits JAR files found in (a possibly set) environment variable pointing to directory where file resides. |
| 42 | + (There should only be a single fits JAR file if this location exists.) |
| 43 | + --> |
| 44 | + <fileset dir="${fits.jar.environment.location}" includes="*.jar" id="fits.jar.environment"> |
35 | 45 | <filename regex="fits.*\.jar" /> <!-- regex takes into account version number in JAR file. -->
|
36 |
| - </fileset> |
37 |
| - <!-- Set property indicating number of FITS JAR files at environment variable location. --> |
38 |
| - <resourcecount refid="fits.jar.environment" property="environ.fits.jar.count" /> |
39 |
| - |
40 |
| - <!-- Location of possible FITS JAR file as set by fallback location as set in properties file. --> |
| 46 | + </fileset> |
| 47 | + <!-- The following can only be called if the refid has a valid 'dir' attribute value. Thus, the 'if' on this target. --> |
| 48 | + <resourcecount refid="fits.jar.environment" property="environ.fits.jar.count" /> |
| 49 | + </target> |
| 50 | + |
| 51 | + <target name="set-fits-jar-fallback-directory-exists"> |
| 52 | + <!-- Set property if the fits.jar fallback directory exists (before checking for JAR file). --> |
| 53 | + <condition property="fits.jar.fallback.location.exists"> |
| 54 | + <available file="${fits.jar.fallback.location}" type="dir"/> |
| 55 | + </condition> |
| 56 | + </target> |
| 57 | + |
| 58 | + <target name="set-fits-jar-location-by-fallback" if="fits.jar.fallback.location.exists" unless="fits.jar.environment.location.exists" |
| 59 | + depends="set-fits-jar-fallback-directory-exists"> |
| 60 | + <!-- |
| 61 | + Directory of possible FITS JAR file as set by fallback location as set in build.properties file. |
| 62 | + Only called if environment variable for fir JAR directory not set. Thus, the 'unless' on this target. |
| 63 | + (There should only be a single fits JAR file if this location exists.) |
| 64 | + --> |
41 | 65 | <fileset dir="${fits.jar.fallback.location}" includes="*.jar" id="fits.jar.fallback">
|
42 | 66 | <filename regex="fits.*\.jar" /> <!-- regex takes into account version number in JAR file. -->
|
43 | 67 | </fileset>
|
44 | 68 | <!-- Set property indicating number of FITS JAR files at fallback location. -->
|
45 | 69 | <resourcecount refid="fits.jar.fallback" property="fallback.fits.jar.count" />
|
| 70 | + </target> |
| 71 | + |
| 72 | + <target name="init" depends="clean, set-fits-jar-location-by-env, set-fits-jar-location-by-fallback"> |
| 73 | + |
| 74 | + <!-- Location of possible FITS JAR file as set by environment variable. --> |
| 75 | + <fileset dir="${fits.jar.environment.location}" includes="*.jar" id="fits.jar.environment"> |
| 76 | + <filename regex="fits.*\.jar" /> <!-- regex takes into account version number in JAR file. --> |
| 77 | + </fileset> |
46 | 78 |
|
47 |
| - <!-- uncomment for property debugging information |
| 79 | + <!-- Property values for FITS JAR file dependency. --> |
48 | 80 | <echo message="fits.jar.environment.location: ${env.fits_jar_location}" />
|
49 |
| - <echo message="fits.jar.fallback.location: ${fits.jar.fallback.location}" /> |
| 81 | + <echo message="fits.jar.environment.location.exists: ${fits.jar.environment.location.exists}" /> |
50 | 82 | <echo message="fits JAR files in environment variable location: ${environ.fits.jar.count}" />
|
| 83 | + <echo message="fits.jar.fallback.location: ${fits.jar.fallback.location}" /> |
| 84 | + <echo message="fits.jar.fallback.location.exists: ${fits.jar.fallback.location.exists}" /> |
51 | 85 | <echo message="fits JAR files in fallback location: ${fallback.fits.jar.count}" />
|
52 |
| - --> |
53 | 86 |
|
54 | 87 | <fail message="*** Either missing FITS JAR file or more than one is present. There should be one and only one FITS JAR file. Cannot build! ***">
|
55 | 88 | <condition>
|
|
61 | 94 | </not>
|
62 | 95 | </condition>
|
63 | 96 | </fail>
|
64 |
| - |
| 97 | + |
| 98 | + <!-- Set fits JAR file for use in comilation. --> |
| 99 | + <condition property="fits.jar.file.dir" value="${fits.jar.environment.location}"> |
| 100 | + <equals arg1="${environ.fits.jar.count}" arg2="1" /> |
| 101 | + </condition> |
| 102 | + <!-- Property cant be set a second time if set in the above condition. --> |
| 103 | + <condition property="fits.jar.file.dir" value="${fits.jar.fallback.location}"> |
| 104 | + <equals arg1="${fallback.fits.jar.count}" arg2="1" /> |
| 105 | + </condition> |
| 106 | + |
65 | 107 | <!-- Verify existance of version properties file containing the expected property. -->
|
66 | 108 | <fail message="Cannot find file: ${build.version.file}">
|
67 | 109 | <condition>
|
|
85 | 127 | </target>
|
86 | 128 |
|
87 | 129 | <target name="compile" depends="init" description="Compile all source code">
|
88 |
| - <javac destdir="${classes.dir}" debug="true" srcdir="${src.dirs}:${test.dirs}" includeantruntime="false" source="1.8" target="1.8"> |
| 130 | + <javac destdir="${classes.dir}" debug="true" srcdir="${src.dirs}:${test.dirs}" includeantruntime="false" source="1.7" target="1.7"> |
89 | 131 | <classpath>
|
90 | 132 | <fileset dir="WebContent/WEB-INF/lib">
|
91 | 133 | <include name="*.jar" />
|
|
94 | 136 | <fileset dir="lib">
|
95 | 137 | <include name="*.jar" />
|
96 | 138 | </fileset>
|
97 |
| - <!-- Already determined that FITS JAR file will be in only one of the following two locations. --> |
98 |
| - <fileset refid="fits.jar.fallback" /> |
99 |
| - <fileset refid="fits.jar.environment" /> |
| 139 | + <fileset dir="${fits.jar.file.dir}"> |
| 140 | + <include name="*.jar"/> |
| 141 | + </fileset> |
100 | 142 | </classpath>
|
101 | 143 | </javac>
|
102 | 144 | </target>
|
|
0 commit comments