source: pro-bachkim-filespace/sourcecode/api.violet.vn/www/plugins/sfPropel13Plugin/lib/vendor/propel-generator/build.xml

Last change on this file was 19, checked in by dungnv, 11 years ago
  • Property svn:mime-type set to text/plain
File size: 7.1 KB
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<resolvepath propertyName="propel.project.dir" file="${project.dir}" dir="${application.startdir}"/>
25
26<!-- set a default target if none provided -->
27<property name="target" value="main"/>
28
29<!-- Set a default name for the build.properties file.
30                This allows for overriding the name of the build.properties file; however,
31                Propel still expects to find the file in the ${propel.project.dir}.
32 -->
33<property name="build.properties" value="build.properties"/>
34       
35<target name="check-buildprops-exists">
36  <available file="${propel.project.dir}/${build.properties}" property="projBuildPopertiesExists"/> 
37</target>
38
39<target name="check-buildprops" unless="projBuildPopertiesExists" depends="check-buildprops-exists">
40                <echo message="====================================================="/>
41                <echo message="Could not open ${build.properties} file:"/>
42                <echo message="         ${propel.project.dir}/${build.properties}"/>
43                <echo message=" "/>
44                <echo message="Make sure that '${propel.project.dir}' is a valid path"/>
45                <echo message="and that it contains a ${build.properties} file."/>
46                <echo message="====================================================="/>
47               
48                <fail message="Missing configuration file (see description above)."/>
49</target>
50
51<target name="check-project-or-dir-set">
52  <condition property="projectOrDirSet">
53                <or>
54                        <isset property="project"/>
55                        <isset property="project.dir"/>
56                </or>
57  </condition>
58</target>
59
60<target name="check-buildprops-for-propel-gen" if="using.propel-gen" unless="projBuildPopertiesExists" depends="check-buildprops-exists">
61        <echo message="=========================================================="/>
62        <echo message="Could not open ${build.properties} file:"/>
63        <echo message="         ${propel.project.dir}/${build.properties}"/>
64        <echo message=" "/>
65        <echo message="Project directory not specified or invalid. You must "/>
66        <echo message="specify the path to your project directory and your "/>
67        <echo message="project directory must contain your ${build.properties} "/>
68        <echo message="and schema.xml files.                                "/>
69        <echo message=" "/>
70        <echo message="Usage: "/>
71        <echo message=" "/>
72        <echo message="$&gt; propel-gen /path/to/projectdir [target]"/>
73        <echo message=" "/>
74        <echo message="=========================================================="/>   
75        <fail message="No project directory specified."/>
76</target>
77
78<target name="check-project-set" unless="projectOrDirSet" depends="check-project-or-dir-set">
79                <echo message="====================================================="/>
80                <echo message="Project not specified. You must enter a project name. "/>
81                <echo message="In the future you can enter it on the command line: "/>
82                <echo message=" "/>
83                <echo message="-Dproject=bookstore"/>
84                <echo message=" "/>
85                <echo message="This will attempt to find your project directory in"/>
86                <echo message="the default directory (./projects/bookstore)."/>
87                <echo message=" "/>
88                <echo message="You can also avoid this message and specicfy a custom "/>
89                <echo message="directory, using the project.dir property:"/>
90                <echo message=" "/>
91                <echo message="-Dproject.dir=/path/to/bookstore"/>
92                <echo message="====================================================="/>
93                <input propertyname="project" promptChar=":">Project name</input>
94                <property name="propel.project" value="${project}" override="true"/>
95</target>
96
97<target name="set-project-dir" unless="project.dir" depends="check-project-set">
98        <echo>No project.dir was specified, using default path: ./projects/${project}</echo>
99        <property name="propel.project.dir" value="./projects/${project}" override="true"/>
100</target>
101
102<target name="configure" depends="set-project-dir,check-buildprops-for-propel-gen,check-buildprops">
103        <if>
104                <isset property="additional.properties"/>
105                <then>
106                        <echo>Processing additional properties file: ${additional.properties}</echo>
107                        <resolvepath propertyName="additional.properties.resolved" file="${additional.properties}" dir="${application.startdir}"/>
108                        <property file="${additional.properties.resolved}"/>
109                </then>
110        </if>
111        <echo msg="Loading project-specific props from ${propel.project.dir}/${build.properties}"/>
112        <property file="${propel.project.dir}/${build.properties}"/>
113</target>
114
115<target name="main" depends="configure" description="The main target. Includes project-specific build.properties and calls the build-propel.xml script">
116
117 <phing phingfile="./build-propel.xml" target="${target}"/>
118 
119</target>
120
121<!--
122 Convenience mappings to build-propel.xml main targets
123 
124 This makes it possible to use this buildfile w/o needing to specify
125 target as a property, e.g.:
126 
127 $> phing -Dproject=bookstore insert-sql
128 
129 The main reason for this is just consistency w/ old build-propel.xml file
130 (primarily for documentation & user confusion avoidance reasons).  There are relatively
131 few & infrequently changing main targets of build-propel.xml, so it's a non-
132 issue as far as maintenance is concerned.
133-->
134
135<target name="convert-conf" depends="configure">
136        <phing phingfile="build-propel.xml" target="convert-conf"/>
137</target>
138
139<target name="create-db" depends="configure">
140        <phing phingfile="build-propel.xml" target="create-db"/>
141</target>
142
143<target name="creole" depends="configure">
144        <phing phingfile="build-propel.xml" target="creole"/>
145</target>
146
147<target name="reverse" depends="configure">
148        <phing phingfile="build-propel.xml" target="reverse"/>
149</target>
150
151<target name="datadtd" depends="configure">
152        <phing phingfile="build-propel.xml" target="datadtd"/>
153</target>
154
155<target name="datadump" depends="configure">
156        <phing phingfile="build-propel.xml" target="datadump"/>
157</target>
158
159<target name="datasql" depends="configure">
160        <phing phingfile="build-propel.xml" target="datasql"/>
161</target>
162
163<target name="insert-sql" depends="configure">
164        <phing phingfile="build-propel.xml" target="insert-sql"/>
165</target>
166
167<target name="om" depends="configure">
168        <phing phingfile="build-propel.xml" target="om"/>
169</target>
170
171<target name="new-om" depends="configure">
172        <phing phingfile="build-propel.xml" target="new-om"/>
173</target>
174
175<target name="sql" depends="configure">
176        <phing phingfile="build-propel.xml" target="sql"/>
177</target>
178
179<target name="old-sql" depends="configure">
180        <phing phingfile="build-propel.xml" target="old-sql"/>
181</target>
182
183<target name="graphviz" depends="configure">
184        <phing phingfile="build-propel.xml" target="graphviz"/>
185</target>
186
187
188</project>
Note: See TracBrowser for help on using the repository browser.