root/branches/1.2/generator/build.xml

Revision 535, 6.8 kB (checked in by heltem, 2 years ago)

Set svn:keywords property uniformly to .php, .xml and .properties files

  • Property svn:keywords set to Id Rev Date Author HeadURL Revision
Line 
1 <!--
2     Use this file to faciliate easy per-project building.
3    
4     Simply create a build.properties file in your project directory,
5     for example ./projects/bookstore/build.properties, that contains
6     any needed (i.e. to override) values for that project.
7    
8     Call this build script and specify the name of the project and
9     (optionally) the name of the target you wish to execute (default is
10     'main' target) of build-propel.xml.
11
12     Normal use:
13     $> phing   -Dproject=bookstore
14    
15     Specific target:
16     $> phing -Dproject=bookstore -Dtarget=insert-sql
17
18 -->
19 <project name="propel-project-builder" default="main" basedir=".">
20
21 <!-- in case ${project.dir} was specified on command line, we set the project.dir
22      property here.  If it wasn't set, then this will be bogus, but it will
23      be overridden by the "set-project-dir" target. -->   
24 <property name="propel.project.dir" value="${project.dir}"/>
25 <resolvepath propertyName="propel.project.dir" file="${propel.project.dir}" dir="${application.startdir}"/>
26
27 <!-- set a default target if none provided -->
28 <property name="target" value="main"/>
29
30 <!-- Set a default name for the build.properties file.
31                 This allows for overriding the name of the build.properties file; however,
32                 Propel still expects to find the file in the ${propel.project.dir}.
33  -->
34 <property name="build.properties" value="build.properties"/>
35        
36 <target name="check-buildprops-exists">
37   <available file="${propel.project.dir}/${build.properties}" property="projBuildPopertiesExists"/> 
38 </target>
39
40 <target name="check-buildprops" unless="projBuildPopertiesExists" depends="check-buildprops-exists">
41                 <echo message="====================================================="/>
42                 <echo message="Could not open ${build.properties} file:"/>
43                 <echo message="         ${propel.project.dir}/${build.properties}"/>
44                 <echo message=" "/>
45                 <echo message="Make sure that '${propel.project.dir}' is a valid path"/>
46                 <echo message="and that it contains a ${build.properties} file."/>
47                 <echo message="====================================================="/>
48                
49                 <fail message="Missing configuration file (see description above)."/>
50 </target>
51
52 <target name="check-project-or-dir-set">
53   <condition property="projectOrDirSet">
54                 <or>
55                         <isset property="project"/>
56                         <isset property="project.dir"/>
57                 </or>
58   </condition>
59 </target>
60
61 <target name="check-buildprops-for-propel-gen" if="using.propel-gen" unless="projBuildPopertiesExists" depends="check-buildprops-exists">
62         <echo message="=========================================================="/>
63         <echo message="Could not open ${build.properties} file:"/>
64         <echo message="         ${propel.project.dir}/${build.properties}"/>
65         <echo message=" "/>
66         <echo message="Project directory not specified or invalid. You must "/>
67         <echo message="specify the path to your project directory and your "/>
68         <echo message="project directory must contain your ${build.properties} "/>
69         <echo message="and schema.xml files.                                "/>
70         <echo message=" "/>
71         <echo message="Usage: "/>
72         <echo message=" "/>
73         <echo message="$&gt; propel-gen /path/to/projectdir [target]"/>
74         <echo message=" "/>
75         <echo message="=========================================================="/>   
76         <fail message="No project directory specified."/>
77 </target>
78
79 <target name="check-project-set" unless="projectOrDirSet" depends="check-project-or-dir-set">
80                 <echo message="====================================================="/>
81                 <echo message="Project not specified. You must enter a project name. "/>
82                 <echo message="In the future you can enter it on the command line: "/>
83                 <echo message=" "/>
84                 <echo message="-Dproject=bookstore"/>
85                 <echo message=" "/>
86                 <echo message="This will attempt to find your project directory in"/>
87                 <echo message="the default directory (./projects/bookstore)."/>
88                 <echo message=" "/>
89                 <echo message="You can also avoid this message and specicfy a custom "/>
90                 <echo message="directory, using the project.dir property:"/>
91                 <echo message=" "/>
92                 <echo message="-Dproject.dir=/path/to/bookstore"/>
93                 <echo message="====================================================="/>
94                 <input propertyname="project" promptChar=":">Project name</input>
95                 <property name="propel.project" value="${project}" override="true"/>
96 </target>
97
98 <target name="set-project-dir" unless="project.dir" depends="check-project-set">
99         <echo>No project.dir was specified, using default path: ./projects/${project}</echo>
100         <property name="propel.project.dir" value="./projects/${project}" override="true"/>
101 </target>
102
103 <target name="configure" depends="set-project-dir,check-buildprops-for-propel-gen,check-buildprops">
104         <echo msg="Loading project-specific props from ${propel.project.dir}/${build.properties}"/>
105         <property file="${propel.project.dir}/${build.properties}"/>
106 </target>
107
108 <target name="main" depends="configure" description="The main target. Includes project-specific build.properties and calls the build-propel.xml script">
109
110  <phing phingfile="./build-propel.xml" target="${target}"/>
111  
112 </target>
113
114 <!--
115  Convenience mappings to build-propel.xml main targets
116  
117  This makes it possible to use this buildfile w/o needing to specify
118  target as a property, e.g.:
119  
120  $> phing -Dproject=bookstore insert-sql
121  
122  The main reason for this is just consistency w/ old build-propel.xml file
123  (primarily for documentation & user confusion avoidance reasons).  There are relatively
124  few & infrequently changing main targets of build-propel.xml, so it's a non-
125  issue as far as maintenance is concerned.
126 -->
127
128 <target name="convert-props" depends="configure">
129         <phing phingfile="build-propel.xml" target="convert-props"/>
130 </target>
131
132 <target name="create-db" depends="configure">
133         <phing phingfile="build-propel.xml" target="create-db"/>
134 </target>
135
136 <target name="creole" depends="configure">
137         <phing phingfile="build-propel.xml" target="creole"/>
138 </target>
139
140 <target name="datadtd" depends="configure">
141         <phing phingfile="build-propel.xml" target="datadtd"/>
142 </target>
143
144 <target name="datadump" depends="configure">
145         <phing phingfile="build-propel.xml" target="datadump"/>
146 </target>
147
148 <target name="datasql" depends="configure">
149         <phing phingfile="build-propel.xml" target="datasql"/>
150 </target>
151
152 <target name="insert-sql" depends="configure">
153         <phing phingfile="build-propel.xml" target="insert-sql"/>
154 </target>
155
156 <target name="om" depends="configure">
157         <phing phingfile="build-propel.xml" target="om"/>
158 </target>
159
160 <target name="new-om" depends="configure">
161         <phing phingfile="build-propel.xml" target="new-om"/>
162 </target>
163
164 <target name="sql" depends="configure">
165         <phing phingfile="build-propel.xml" target="sql"/>
166 </target>
167
168 <target name="old-sql" depends="configure">
169         <phing phingfile="build-propel.xml" target="old-sql"/>
170 </target>
171
172 <target name="graphviz" depends="configure">
173         <phing phingfile="build-propel.xml" target="graphviz"/>
174 </target>
175
176
177 </project>
Note: See TracBrowser for help on using the browser.