Skip to content

Instantly share code, notes, and snippets.

@viccherubini
Created November 10, 2012 11:26
Show Gist options
  • Save viccherubini/4050815 to your computer and use it in GitHub Desktop.
Save viccherubini/4050815 to your computer and use it in GitHub Desktop.
Symfony Phing build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project name="Sample Symfony Application" default="build">
<resolvepath propertyName="root_path" file="./" />
<resolvepath propertyName="config_path" file="./app/config/" />
<php function="date" returnProperty="build_date">
<param value="c" />
</php>
<available file="${build_settings_file}" property="build_settings_file_exists" value="1" />
<if>
<equals arg1="${build_settings_file_exists}" arg2="1" />
<then>
<property file="${build_settings_file}" />
</then>
</if>
<target name="build" depends="clean,compile-configuration,compile-vendors,warmup"></target>
<target name="integrate" depends="clean,compile-configuration,compile-vendors,warmup,migrate-db,run-tests"></target>
<target name="clean">
<delete dir="${root_path}/vendor/" />
<delete file="${root_path}/vendor" />
<delete file="${root_path}/app/bootstrap.php.cache" />
</target>
<target name="compile-vendors">
<available file="${vendor_path}" property="vendor_path_exists" value="1" />
<if>
<equals arg1="${vendor_path_exists}" arg2="1" />
<then>
<symlink target="${vendor_path}" link="${root_path}/vendor" />
</then>
</if>
<exec command="composer.phar install" returnProperty="vendors_output" />
</target>
<target name="compile-configuration">
<copy file="${config_path}/parameters.yml.template" tofile="${config_path}/parameters.yml" overwrite="true">
<filterchain>
<replacetokens begintoken="@@" endtoken="@@">
<token key="DB_SETTINGS_HOST" value="${db_settings.host}" />
<token key="DB_SETTINGS_DATABASE" value="${db_settings.database}" />
<token key="DB_SETTINGS_USERNAME" value="${db_settings.username}" />
<token key="DB_SETTINGS_PASSWORD" value="${db_settings.password}" />
<token key="DB_SETTINGS_TEST_HOST" value="${db_settings_test.host}" />
<token key="DB_SETTINGS_TEST_DATABASE" value="${db_settings_test.database}" />
<token key="DB_SETTINGS_TEST_USERNAME" value="${db_settings_test.username}" />
<token key="DB_SETTINGS_TEST_PASSWORD" value="${db_settings_test.password}" />
<token key="BUILD_DATE" value="${build_date}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="warmup">
<exec command="php ${root_path}/app/console assets:install web --no-interaction --no-ansi --symlink --env=prod" />
<exec command="php ${root_path}/app/console cache:clear --env=prod --no-interaction --no-ansi" />
<exec command="php ${root_path}/app/console cache:clear --env=test --no-interaction --no-ansi" />
<exec command="php ${root_path}/app/console cache:warmup --env=test --no-interaction --no-ansi" />
<exec command="php ${root_path}/app/console cache:warmup --env=prod --no-interaction --no-ansi" />
</target>
<target name="migrate-db">
<exec command="php app/console doctrine:migrations:migrate --no-interaction --no-ansi" checkreturn="true" />
</target>
<target name="run-tests">
<exec command="phpunit -c app" checkreturn="true" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment