Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tag: 1.6.0
Fetching contributors…

Cannot retrieve contributors at this time

239 lines (189 sloc) 8.94 kB
<!--
Use this file to faciliate easy per-project building.
Simply create a build.properties file in your project directory,
for example ./projects/bookstore/build.properties, that contains
any needed (i.e. to override) values for that project.
Call this build script and specify the name of the project and
(optionally) the name of the target you wish to execute (default is
'main' target) of build-propel.xml.
Normal use:
$> phing -Dproject=bookstore
Specific target:
$> phing -Dproject=bookstore -Dtarget=insert-sql
-->
<project name="propel-project-builder" default="main">
<!-- in case ${project.dir} was specified on command line, we set the project.dir
property here. If it wasn't set, then this will be bogus, but it will
be overridden by the "set-project-dir" target. -->
<resolvepath propertyName="propel.project.dir" file="${project.dir}" dir="${application.startdir}"/>
<!-- set a default target if none provided -->
<property name="target" value="main"/>
<!-- Set a default name for the build.properties file.
This allows for overriding the name of the build.properties file; however,
Propel still expects to find the file in the ${propel.project.dir}.
-->
<property name="build.properties" value="build.properties"/>
<target name="check-buildprops-exists">
<available file="${propel.project.dir}/${build.properties}" property="projBuildPopertiesExists"/>
</target>
<target name="check-buildprops" unless="projBuildPopertiesExists" depends="check-buildprops-exists">
<echo message="====================================================="/>
<echo message="Could not open ${build.properties} file:"/>
<echo message=" ${propel.project.dir}${build.properties}"/>
<echo message=" "/>
<echo message="Make sure that '${propel.project.dir}' is a valid path"/>
<echo message="and that it contains a ${build.properties} file."/>
<echo message="====================================================="/>
<fail message="Missing configuration file (see description above)."/>
</target>
<target name="check-project-or-dir-set">
<condition property="projectOrDirSet">
<or>
<isset property="project"/>
<isset property="project.dir"/>
</or>
</condition>
</target>
<target name="check-buildprops-for-propel-gen" if="using.propel-gen" unless="projBuildPopertiesExists" depends="check-buildprops-exists">
<echo message="=========================================================="/>
<echo message=" Welcome to Propel!"/>
<echo message=" "/>
<echo message="The propel-gen script requires a ${build.properties} file"/>
<echo message="to run. Either you didn't create one already, or this file"/>
<echo message="is not where the propel-gen script is looking for it."/>
<echo message=" "/>
<echo message="Expected ${build.properties} file location is:"/>
<echo message=" ${propel.project.dir}${build.properties}"/>
<echo message=" "/>
<echo message="The propel-gen script expects the name of a task to execute:"/>
<echo message=" "/>
<echo message="$&gt; propel-gen [taskname]"/>
<echo message=" "/>
<echo message="If you call the script from another directory than the one where"/>
<echo message="where the ${build.properties} file is, set the path to this"/>
<echo message="file as first argument of the script:"/>
<echo message=" "/>
<echo message="$&gt; propel-gen /path/to/projectdir [taskname]"/>
<echo message=" "/>
<echo message="Available tasknames are:"/>
<echo message=" om"/>
<echo message=" convert-conf"/>
<echo message=" sql"/>
<echo message=" insert-sql"/>
<echo message=" diff"/>
<echo message=" status"/>
<echo message=" migrate"/>
<echo message=" up"/>
<echo message=" down"/>
<echo message=" reverse"/>
<echo message=" ... and a few others."/>
<echo message="But you should start by creating a schema."/>
<echo message="=========================================================="/>
<fail message="No project directory specified."/>
</target>
<target name="check-project-set" unless="projectOrDirSet" depends="check-project-or-dir-set">
<echo message="====================================================="/>
<echo message="Project not specified. You must enter a project name. "/>
<echo message="In the future you can enter it on the command line: "/>
<echo message=" "/>
<echo message="-Dproject=bookstore"/>
<echo message=" "/>
<echo message="This will attempt to find your project directory in"/>
<echo message="the default directory (./projects/bookstore)."/>
<echo message=" "/>
<echo message="You can also avoid this message and specicfy a custom "/>
<echo message="directory, using the project.dir property:"/>
<echo message=" "/>
<echo message="-Dproject.dir=/path/to/bookstore"/>
<echo message="====================================================="/>
<input propertyname="project" promptChar=":">Project name</input>
<property name="propel.project" value="${project}" override="true"/>
</target>
<target name="set-project-dir" unless="project.dir" depends="check-project-set">
<echo>No project.dir was specified, using default path: ./projects/${project}</echo>
<property name="propel.project.dir" value="./projects/${project}" override="true"/>
</target>
<target name="configure" depends="set-project-dir,check-buildprops-for-propel-gen,check-buildprops">
<if>
<isset property="additional.properties"/>
<then>
<echo>Processing additional properties file: ${additional.properties}</echo>
<resolvepath propertyName="additional.properties.resolved" file="${additional.properties}" dir="${application.startdir}"/>
<property file="${additional.properties.resolved}"/>
</then>
</if>
<echo msg="Loading project-specific props from ${propel.project.dir}/${build.properties}"/>
<property file="${propel.project.dir}/${build.properties}"/>
</target>
<target name="main" depends="configure" description="The main target. Includes project-specific build.properties and calls the build-propel.xml script">
<phing phingfile="./build-propel.xml" target="${target}"/>
</target>
<!--
Convenience mappings to build-propel.xml main targets
This makes it possible to use this buildfile w/o needing to specify
target as a property, e.g.:
$> phing -Dproject=bookstore insert-sql
The main reason for this is just consistency w/ old build-propel.xml file
(primarily for documentation & user confusion avoidance reasons). There are relatively
few & infrequently changing main targets of build-propel.xml, so it's a non-
issue as far as maintenance is concerned.
-->
<target name="convert-conf" depends="configure">
<phing phingfile="build-propel.xml" target="convert-conf"/>
</target>
<target name="create-db" depends="configure">
<phing phingfile="build-propel.xml" target="create-db"/>
</target>
<target name="reverse" depends="configure">
<phing phingfile="build-propel.xml" target="reverse"/>
</target>
<target name="datadump" depends="configure">
<phing phingfile="build-propel.xml" target="datadump"/>
</target>
<target name="datasql" depends="configure">
<phing phingfile="build-propel.xml" target="datasql"/>
</target>
<target name="insert-sql" depends="configure">
<phing phingfile="build-propel.xml" target="insert-sql"/>
</target>
<target name="om" depends="configure">
<phing phingfile="build-propel.xml" target="om"/>
</target>
<target name="new-om" depends="configure">
<phing phingfile="build-propel.xml" target="new-om"/>
</target>
<target name="sql" depends="configure">
<phing phingfile="build-propel.xml" target="sql"/>
</target>
<target name="sql-diff" depends="configure">
<phing phingfile="build-propel.xml" target="sql-diff"/>
</target>
<target name="diff" depends="sql-diff" />
<target name="migration-status" depends="configure">
<phing phingfile="build-propel.xml" target="migration-status"/>
</target>
<target name="status" depends="migration-status" />
<target name="migration-up" depends="configure">
<phing phingfile="build-propel.xml" target="migration-up"/>
</target>
<target name="migrate-up" depends="migration-up" />
<target name="up" depends="migration-up" />
<target name="migration-down" depends="configure">
<phing phingfile="build-propel.xml" target="migration-down"/>
</target>
<target name="migrate-down" depends="migration-down" />
<target name="down" depends="migration-down" />
<target name="migration" depends="configure">
<phing phingfile="build-propel.xml" target="migration"/>
</target>
<target name="migrate" depends="migration" />
<target name="old-sql" depends="configure">
<phing phingfile="build-propel.xml" target="old-sql"/>
</target>
<target name="dbd2propel" depends="configure">
<phing phingfile="build-propel.xml" target="dbd2propel"/>
</target>
<target name="graphviz" depends="configure">
<phing phingfile="build-propel.xml" target="graphviz"/>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.