Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <property name="environment" value="local" />
- <target name="config">
- <!-- configuration logic goes here -->
- </target>
- <target name="buildmyproject" depends="config">
- <!-- this target builds your project, but runs the config target first -->
- </target>
- <target name="config">
- <property name="configFile" value="${environment}.config.xml" />
- <if test="${file::exists(configFile)}">
- <echo message="Loading ${configFile}..." />
- <include buildfile="${configFile}" />
- </if>
- <if test="${not file::exists(configFile) and environment != 'local'}">
- <fail message="Configuration file '${configFile}' could not be found." />
- </if>
- </target>
- <include buildfile="devPropertyFile.build" if="${buildEnvironment == 'DEV'}"/>
- <include buildfile="testPropertyFile.build" if="${buildEnvironment == 'TEST'}"/>
- <include buildfile="prodPropertyFile.build" if="${buildEnvironment == 'PROD'}"/>
- <target name="dev">
- <property name="environment" value="dev"/>
- <call target="importProperties" cascade="false"/>
- </target>
- <target name="test">
- <property name="environment" value="test"/>
- <call target="importProperties" cascade="false"/>
- </target>
- <target name="stage">
- <property name="environment" value="stage"/>
- <call target="importProperties" cascade="false"/>
- </target>
- <target name="importProperties">
- <property name="propertiesFile" value="properties.${environment}.build"/>
- <if test="${file::exists(propertiesFile)}">
- <include buildfile="${propertiesFile}"/>
- </if>
- <if test="${not file::exists(propertiesFile)}">
- <fail message="Properties file ${propertiesFile} could not be found."/>
- </if>
- </target>
- <project default="all">
- <include buildfile="wip.build"/>
- <target name="all">
- <echo message="Building default target " />
- <call target="WipTarget" />
- </target>
- </project>
Add Comment
Please, Sign In to add comment