Fixed phing build to include Documentation/Examples

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@68318 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-02-10 16:30:33 +00:00
parent 0fd77aa397
commit 9b40f3edf5
1 changed files with 36 additions and 21 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project name="PHPExcel" default="release-standard" basedir="."> <project name="PHPExcel" default="release-standard" basedir=".">
<taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2"/> <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2"/>
<propertyprompt propertyName="packageVersion" defaultValue="1.0.0" <propertyprompt propertyName="packageVersion" defaultValue="1.0.0"
promptText="Enter PHPExcel version number" /> promptText="Enter PHPExcel version number" />
<propertyprompt propertyName="releaseDate" defaultValue="2010-01-01" <propertyprompt propertyName="releaseDate" defaultValue="2010-01-01"
@ -22,11 +22,11 @@
return $this->filesets[$num-1]; return $this->filesets[$num-1];
} }
function main() { function main() {
if ($this->destinationFile === null || empty($this->filesets)) { if ($this->destinationFile === null || empty($this->filesets)) {
throw new BuildException("You must specify a file or fileset(s) for the <phpzip> task."); throw new BuildException("You must specify a file or fileset(s) for the <phpzip> task.");
} }
// compile a list of all files to add to the file, both file attrib and fileset elements // compile a list of all files to add to the file, both file attrib and fileset elements
// can be used. // can be used.
$files = array(); $files = array();
@ -43,27 +43,27 @@
} catch (BuildException $be) { } catch (BuildException $be) {
$this->log($be->getMessage(), Project::MSG_WARN); $this->log($be->getMessage(), Project::MSG_WARN);
} }
} }
} }
$objZip = new ZipArchive(); $objZip = new ZipArchive();
if ($objZip->open($this->destinationFile, ZIPARCHIVE::OVERWRITE) !== true) { if ($objZip->open($this->destinationFile, ZIPARCHIVE::OVERWRITE) !== true) {
throw new Exeption("Could not open " . $strResultingFile . " for writing!"); throw new Exeption("Could not open " . $strResultingFile . " for writing!");
} }
$this->log("Creating ZIP archive of " . count($files) . " files..."); $this->log("Creating ZIP archive of " . count($files) . " files...");
foreach($files as $file) { foreach($files as $file) {
$this->log("Processing file " . $this->_cleanFileName($file) . " ..."); $this->log("Processing file " . $this->_cleanFileName($file) . " ...");
$contents = file_get_contents($file); $contents = file_get_contents($file);
$objZip->addFromString( $this->_cleanFileName($file), $contents ); $objZip->addFromString( $this->_cleanFileName($file), $contents );
} }
$objZip->close(); $objZip->close();
$this->log("Created ZIP archive " . $this->destinationFile . '.'); $this->log("Created ZIP archive " . $this->destinationFile . '.');
} }
/** /**
* Cleanup a filename * Cleanup a filename
* *
@ -74,17 +74,17 @@
$strFile = str_replace('../', '', $strFile); $strFile = str_replace('../', '', $strFile);
$strFile = str_replace('.\\build\\', '', $strFile); $strFile = str_replace('.\\build\\', '', $strFile);
$strFile = str_replace('WINDOWS', '', $strFile); $strFile = str_replace('WINDOWS', '', $strFile);
while (preg_match('/\/\//i', $strFile)) { while (preg_match('/\/\//i', $strFile)) {
$strFile = str_replace('//', '/', $strFile); $strFile = str_replace('//', '/', $strFile);
} }
return $strFile; return $strFile;
} }
} }
]]> ]]>
</adhoc-task> </adhoc-task>
<target name="prepare"> <target name="prepare">
<echo msg="Creating build directory: ./build" /> <echo msg="Creating build directory: ./build" />
<mkdir dir="./build" /> <mkdir dir="./build" />
@ -99,7 +99,7 @@
<exclude name="**/.svn" /> <exclude name="**/.svn" />
</fileset> </fileset>
</copy> </copy>
<copy todir="./build/Documentation" overwrite="true"> <copy todir="./build/Documentation" overwrite="true">
<fileset dir="../Documentation"> <fileset dir="../Documentation">
<include name="*.*" /> <include name="*.*" />
@ -107,14 +107,21 @@
</fileset> </fileset>
</copy> </copy>
<mkdir dir="./build/Documentation/API" /> <mkdir dir="./build/Documentation/API" />
<copy todir="./build/Documentation/Examples" overwrite="true">
<fileset dir="../Documentation/Examples">
<include name="**.*" />
<exclude name="**/.svn" />
</fileset>
</copy>
<copy todir="./build/Tests" overwrite="true"> <copy todir="./build/Tests" overwrite="true">
<fileset dir="../Tests"> <fileset dir="../Tests">
<include name="**/*" /> <include name="**/*" />
<exclude name="**/.svn" /> <exclude name="**/.svn" />
</fileset> </fileset>
</copy> </copy>
<copy file="../changelog.txt" tofile="./build/changelog.txt" overwrite="true" /> <copy file="../changelog.txt" tofile="./build/changelog.txt" overwrite="true" />
<copy file="../license.txt" tofile="./build/license.txt" overwrite="true" /> <copy file="../license.txt" tofile="./build/license.txt" overwrite="true" />
<copy file="../install.txt" tofile="./build/install.txt" overwrite="true" /> <copy file="../install.txt" tofile="./build/install.txt" overwrite="true" />
@ -162,7 +169,7 @@
<target name="release-standard" depends="apidocs"> <target name="release-standard" depends="apidocs">
<mkdir dir="./release" /> <mkdir dir="./release" />
<echo msg="Creating release package (v${packageVersion})..." /> <echo msg="Creating release package (v${packageVersion})..." />
<phpzip destfile="./release/${packageVersion}.zip"> <phpzip destfile="./release/${packageVersion}.zip">
<fileset dir="./build"> <fileset dir="./build">
@ -176,9 +183,9 @@
<target name="release-pear" depends="versionNumber"> <target name="release-pear" depends="versionNumber">
<mkdir dir="./release" /> <mkdir dir="./release" />
<echo msg="Creating PEAR release package (v${packageVersion})..." /> <echo msg="Creating PEAR release package (v${packageVersion})..." />
<d51pearpkg2 dir="./build/Classes" baseinstalldir="PHPExcel"> <d51pearpkg2 dir="./build/Classes" baseinstalldir="PHPExcel">
<name>PHPExcel</name> <name>PHPExcel</name>
<summary>PHP Excel classes</summary> <summary>PHP Excel classes</summary>
@ -194,7 +201,7 @@
<pear minimum_version="1.4.0"/> <pear minimum_version="1.4.0"/>
<extension name="zip" minimum_version="1.8.0"/> <extension name="zip" minimum_version="1.8.0"/>
</dependencies> </dependencies>
<dirroles key="PHPExcel/Shared/PDF/fonts">data</dirroles> <dirroles key="PHPExcel/Shared/PDF/fonts">data</dirroles>
</d51pearpkg2> </d51pearpkg2>
<exec command="pear package ./build/Classes/package.xml"/> <exec command="pear package ./build/Classes/package.xml"/>
@ -210,8 +217,16 @@
<echo msg="Creating documentation release (v${packageVersion})..." /> <echo msg="Creating documentation release (v${packageVersion})..." />
<copy todir="./release" overwrite="true"> <copy todir="./release" overwrite="true">
<fileset dir="../Documentation"> <fileset dir="../Documentation">
<include name="*.doc" /> <include name="*.*" />
<exclude name="**/.svn" />
</fileset> </fileset>
</copy> </copy>
<copy todir="./release/Examples" overwrite="true">
<fileset dir="../Documentation/Examples">
<include name="**.*" />
<exclude name="**/.svn" />
</fileset>
</copy>
</target> </target>
</project> </project>