Skip to content
This repository
Browse code

Adding phing build.xml

  • Loading branch information...
commit 864cb3920cbd7825c8d3ccc7ee64b0b016c3b36c 1 parent 6c35469
Mark Story authored December 28, 2011
6  build.properties
... ...
@@ -0,0 +1,6 @@
  1
+# Name
  2
+project.name = CakePHP
  3
+
  4
+# Directories
  5
+build.dir = build
  6
+dist.dir = dist
125  build.xml
... ...
@@ -0,0 +1,125 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<project name="CakePHP" default="build">
  3
+	<taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
  4
+
  5
+	<property file="build.properties" />
  6
+	<property name="package" value="${phing.project.name}" override="true" />
  7
+
  8
+	<!--
  9
+		The set of files we're going to package
  10
+		Exclude the cli scripts, as they get installed separately.
  11
+	 -->
  12
+	<fileset id="libs" dir="./lib/Cake">
  13
+		<include name="**" />
  14
+		<exclude name="Console/cake.bat" />
  15
+		<exclude name="Console/cake.php" />
  16
+		<exclude name="Console/cake" />
  17
+	</fileset>
  18
+
  19
+	<!--
  20
+		CLI scripts to package and install
  21
+	-->
  22
+	<fileset id="cli" dir="./lib/Cake/Console">
  23
+		<include name="cake.bat" />
  24
+		<include name="cake.php" />
  25
+		<include name="cake" />
  26
+	</fileset>
  27
+
  28
+
  29
+	<!-- start fresh each time.  Remove the dist and build dirs -->
  30
+	<target name="clean">
  31
+		<delete dir="${build.dir}" includeemptydirs="true" />
  32
+		<delete dir="${dist.dir}" includeemptydirs="true" />
  33
+	</target>
  34
+
  35
+	<!-- makes directories and sets properties -->
  36
+	<target name="prepare" depends="clean">
  37
+		<echo msg="Creating build + dist directories." />
  38
+		<mkdir dir="${build.dir}" />
  39
+		<mkdir dir="${dist.dir}" />
  40
+
  41
+		<exec executable="php" outputProperty="version">
  42
+			<arg value="-r" />
  43
+			<arg value="$fh = file('./lib/Cake/VERSION.txt'); echo strtoupper(array_pop($fh));" />
  44
+		</exec>
  45
+
  46
+		<!-- set PEAR stability based on version number. -->
  47
+		<condition property="pear.stability" value="beta">
  48
+			<contains string="${version}" substring="beta" casesensitive="false"/>
  49
+		</condition>
  50
+		<condition property="pear.stability" value="alpha">
  51
+			<contains string="${version}" substring="alpha" casesensitive="false"/>
  52
+		</condition>
  53
+		<condition property="pear.stability" value="devel">
  54
+			<contains string="${version}" substring="dev" casesensitive="false"/>
  55
+		</condition>
  56
+		<condition property="pear.stability" value="beta">
  57
+			<contains string="${version}" substring="rc" casesensitive="false" />
  58
+		</condition>
  59
+		<condition property="pear.stability" value="stable">
  60
+			<not><isset property="pear.stability"/></not>
  61
+		</condition>
  62
+
  63
+		<!-- pear versions need to not have '-' -->
  64
+		<exec executable="php" outputProperty="pear.version">
  65
+			<arg value="-r" />
  66
+			<arg value="echo str_replace(array('-'), array(''), '${version}');" />
  67
+		</exec>
  68
+
  69
+		<echo msg="Preparing package of ${version} (${pear.version}+${pear.stability})" />
  70
+	</target>
  71
+
  72
+	<!--
  73
+		Copy all the files to build/ so they can be packaged up.
  74
+	-->
  75
+	<target name="copy-files" depends="prepare">
  76
+		<echo msg="Copying files to build directory" />
  77
+		<copy todir="${build.dir}/${project.name}-${version}/Cake">
  78
+			<fileset refid="libs" />
  79
+		</copy>
  80
+		<copy todir="${build.dir}/${project.name}-${version}/bin">
  81
+			<fileset refid="cli" />
  82
+		</copy>
  83
+	</target>
  84
+
  85
+	<!--
  86
+		Define the package.xml.  Using xml to make xml is fun!
  87
+	-->
  88
+	<target name="define-pear-package" depends="copy-files">
  89
+		<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/${project.name}-${version}">
  90
+			<name>CakePHP</name>
  91
+			<summary>CakePHP Framework</summary>
  92
+			<channel>pear.php.net</channel>
  93
+			<description>CakePHP </description>
  94
+			<lead user="mark_story" name="Mark Story" email="mark@mark-story.com" />
  95
+			<license>MIT License</license>
  96
+			<version release="${pear.version}" api="${pear.version}" />
  97
+			<stability release="${pear.stability}" api="${pear.stability}" />
  98
+			<notes>http://github.com/cakephp/cakephp/blob/master/README</notes>
  99
+			<dependencies>
  100
+				<php minimum_version="5.2.9" />
  101
+				<pear minimum_version="1.9.0" recommended_version="1.9.4" />
  102
+				<package name="PHPUnit" channel="pear.phpunit.de" minimum_version="3.5.0" type="optional" />
  103
+			</dependencies>
  104
+			<dirroles key="bin">script</dirroles>
  105
+			<release>
  106
+				<install as="cake" name="bin/cake" />
  107
+				<install as="cake.php" name="bin/cake.php" />
  108
+				<install as="cake.bat" name="bin/cake.bat" />
  109
+			</release>
  110
+		</d51pearpkg2>
  111
+	</target>
  112
+
  113
+	<!-- Generate the PEAR package from a directory and move the files to the dist folder -->
  114
+	<target name="generate-package" depends="define-pear-package">
  115
+		<exec command="pear package" dir="${build.dir}/${project.name}-${version}" passthru="true"/>
  116
+		<echo msg="Moving ${project.name}-${pear.version}.tgz"/>
  117
+		<move file="${build.dir}/${project.name}-${version}/${project.name}-${pear.version}.tgz" todir="${dist.dir}" />
  118
+	</target>
  119
+
  120
+	<!-- top level easy to type target -->
  121
+	<target name="build" depends="generate-package" />
  122
+
  123
+
  124
+
  125
+</project>

0 notes on commit 864cb39

Please sign in to comment.
Something went wrong with that request. Please try again.