Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

root/openmrs-modules/foodprogram/build.xml

Revision 4229, 4.4 kB (checked in by ball, 8 months ago)

Food program module as created by Christian Allen for Rwanda Partners In Health. This is migrated from the PIH subversion repository.

Line 
1 <?xml version="1.0"?>
2 <!-- ********************************************************* -->
3 <!-- ** Food Program Module                                                                     ** -->
4 <!-- **                                                                                                         ** -->
5 <!-- ** @author Justin Miranda                                                          ** -->
6 <!-- ** @version 0.1                                                                            ** -->
7 <!-- ********************************************************* -->
8 <project name="FoodProgramModule" default="package-module">
9                
10         <!-- *********************************************************** -->
11         <!-- **                     TARGETS                           ** -->
12         <!-- *********************************************************** -->
13         <target name="init" description="initialization">
14                 <xmlcatalog id="common-dtds">
15                 <dtd
16                     publicId="-//OpenMRS//DTD OpenMRS Config 1.0//EN"
17                     location="lib-common/config-1.0.dtd"/>
18             </xmlcatalog>
19                
20                 <xmlproperty file="metadata/config.xml" >
21                         <xmlcatalog refid="common-dtds"/>
22                 </xmlproperty>
23                                
24                 <property name="compile.arguments" value="-target 1.5" />
25                
26                 <filterset id="variables.to.replace">
27                         <filter token="MODULE_ID" value="${module.id}" />
28                         <filter token="MODULE_NAME" value="${module.name}" />
29                         <filter token="MODULE_VERSION" value="${module.version}" />
30                         <filter token="MODULE_PACKAGE" value="${module.package}" />
31                 </filterset>
32                
33                 <path id="classpath">
34                         <fileset dir="lib">
35                                 <include name="**/*.jar"/>
36                         </fileset>
37                         <fileset dir="lib-common">
38                                 <include name="**/*.jar"/>
39                         </fileset>
40                 </path>
41
42         </target>
43
44         <target name="clean" description="Delete build and dist directories">
45                 <delete dir="dist" />
46                 <delete dir="build" />
47         </target>
48
49         <target name="compile-module" depends="init" description="Compiles the module">
50                 <mkdir dir="build" />
51                
52                 <!-- Copy other source data to the build folder -->
53                 <copy todir="build">
54                         <fileset dir="src/" excludes="**/*.java" />
55                 </copy>
56                
57                 <!--  Compile module java files -->
58                 <javac destdir="build" classpathref="classpath" debug="true" debuglevel="lines,vars,source">
59                         <compilerarg line="${compile.arguments}" />
60                         <src path="src/" />
61                         <include name="**/*.java" />
62                 </javac>
63                
64                 <!--  Compile module web java files -->
65                 <javac destdir="build" classpathref="classpath" debug="true" debuglevel="lines,vars,source">
66                         <compilerarg line="${compile.arguments}" />
67                         <src path="web/src/" />
68                         <include name="**/*.java" />
69                 </javac>
70                
71         </target>
72        
73         <target name="package-module" depends="compile-module" description="Packages module into jar file">
74                 <mkdir dir="dist" />
75                
76                 <!-- Copy module metadata -->
77                 <copy todir="build/">
78                         <fileset dir="metadata/" includes="**/*" />
79                         <filterset refid="variables.to.replace" />
80                 </copy>
81                
82                 <!-- Copy module web data -->
83                 <copy todir="build/web/module/">
84                         <fileset dir="web/module/" includes="**/*" />
85                         <filterset refid="variables.to.replace" />
86                 </copy>
87                
88                 <!-- Copy lib folder -->
89                 <!-- (lib should only contain this module's required -->
90                 <!-- libraries that OpenMRS doesn't contain already) -->
91                 <copy todir="build/lib" failonerror="false">
92                         <fileset dir="lib" includes="**/*" />
93                 </copy>
94                
95                 <!-- Create distributable jar file -->
96                 <jar destfile="dist/${module.id}-${module.version}.omod">
97                         <fileset dir="build" includes="**/*" />
98                 </jar>
99         </target>
100        
101         <target name="deploy-module" depends="package-module" description="Deploys/copies module to modules director; Requires Tomcat restart">
102                 <!-- c:/Documents and Settings/Justin Miranda/Application Data/OpenMRS/modules -->
103                 <!-- c:/Application Data/OpenMRS/modules -->
104                 <copy todir="c:/Documents and Settings/Justin Miranda/Application Data/OpenMRS/modules">
105                         <fileset file="dist/${module.name}-${module.version}.omod" />
106                 </copy>
107         </target>
108                
109         <!-- Not intended to be committed. I'm only using this for convenience until I can figure out a better solution -->
110         <target name="deploy-web" depends="package-module">     
111                 <copy todir="dist/web/module">
112                         <fileset dir="web/module"/>
113                 </copy>
114                 <touch>
115                         <fileset dir="dist/web/module"/>
116                 </touch>
117                 <copy todir="c:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/openmrs/WEB-INF/view/module/${module.id}">
118                         <fileset dir="dist/web/module"/>
119                 </copy>
120                 <!-- Copy the latest module to the modules directory to reflect changes (module will be deployed on Tomcat restart) -->
121                 <antcall target="deploy-module"/>
122         </target>       
123        
124
125 </project>
Note: See TracBrowser for help on using the browser.