Updated build scripts
This commit is contained in:
parent
264fe4260a
commit
593371da62
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
spl_autoload_register(function ($class) {
|
||||
include 'phar://PHPExcel/' . str_replace('_', '/', $class) . '.php';
|
||||
});
|
||||
|
||||
try {
|
||||
Phar::mapPhar();
|
||||
include 'phar://PHPExcel/PHPExcel.php';
|
||||
} catch (PharException $e) {
|
||||
error_log($e->getMessage());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
__HALT_COMPILER();
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2012 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
|
||||
# required: PHP 5.3+ and zlib extension
|
||||
|
||||
// ini option check
|
||||
if (ini_get('phar.readonly')) {
|
||||
echo "php.ini: set the 'phar.readonly' option to 0 to enable phar creation\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// output name
|
||||
$pharName = 'PHPExcel.phar';
|
||||
|
||||
// target folder
|
||||
$sourceDir = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Classes' . DIRECTORY_SEPARATOR;
|
||||
|
||||
// default meta information
|
||||
$metaData = array(
|
||||
'Author' => 'Mark Baker <mbaker@inviqa.com>',
|
||||
'Description' => 'A pure PHP library for reading and writing spreadsheet files',
|
||||
'Copyright' => 'Mark Baker (c) 2006-' . date('Y'),
|
||||
'Timestamp' => time(),
|
||||
'Version' => '##VERSION##',
|
||||
'Date' => '##DATE##'
|
||||
);
|
||||
|
||||
// cleanup
|
||||
if (file_exists($pharName)) {
|
||||
echo "Removed: {$pharName}\n";
|
||||
unlink($pharName);
|
||||
}
|
||||
|
||||
echo "Building...\n";
|
||||
|
||||
// the phar object
|
||||
$phar = new Phar($pharName, null, 'PHPExcel');
|
||||
$phar->buildFromDirectory($sourceDir);
|
||||
$phar->setStub(
|
||||
<<<'EOT'
|
||||
<?php
|
||||
spl_autoload_register(function ($class) {
|
||||
include 'phar://PHPExcel/' . str_replace('_', '/', $class) . '.php';
|
||||
});
|
||||
|
||||
try {
|
||||
Phar::mapPhar();
|
||||
include 'phar://PHPExcel/PHPExcel.php';
|
||||
} catch (PharException $e) {
|
||||
error_log($e->getMessage());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
__HALT_COMPILER();
|
||||
EOT
|
||||
);
|
||||
$phar->setMetadata($metaData);
|
||||
$phar->compressFiles(Phar::GZ);
|
||||
|
||||
echo "Complete.\n";
|
||||
|
||||
exit();
|
|
@ -0,0 +1,2 @@
|
|||
@ECHO OFF
|
||||
phing -f build.xml release-phar
|
266
Build/build.xml
266
Build/build.xml
|
@ -2,139 +2,76 @@
|
|||
<project name="PHPExcel" default="release-standard" basedir=".">
|
||||
<taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2"/>
|
||||
|
||||
<target name="gather">
|
||||
<if>
|
||||
<isfalse value="${packageVersion}"/>
|
||||
<then>
|
||||
<propertyprompt propertyName="packageVersion" defaultValue="1.0.0"
|
||||
promptText="Enter PHPExcel version number" />
|
||||
promptText="Enter PHPExcel version number"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<isfalse value="${releaseDate}"/>
|
||||
<then>
|
||||
<propertyprompt propertyName="releaseDate" defaultValue="2010-01-01"
|
||||
promptText="Enter PHPExcel release date" />
|
||||
promptText="Enter PHPExcel release date"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<isfalse value="${documentFormat}"/>
|
||||
<then>
|
||||
<propertyprompt propertyName="documentFormat" defaultValue="doc"
|
||||
promptText="Enter Document Format" />
|
||||
promptText="Enter Document Format"/>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<adhoc-task name="phpzip">
|
||||
<![CDATA[
|
||||
class PhpZipTask extends Task {
|
||||
private $destinationFile;
|
||||
private $filesets = array();
|
||||
|
||||
function setDestfile(PhingFile $f) {
|
||||
$this->destinationFile = $f;
|
||||
}
|
||||
|
||||
function createFileSet() {
|
||||
$num = array_push($this->filesets, new FileSet());
|
||||
return $this->filesets[$num-1];
|
||||
}
|
||||
|
||||
function main() {
|
||||
if ($this->destinationFile === null || empty($this->filesets)) {
|
||||
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
|
||||
// can be used.
|
||||
$files = array();
|
||||
if (!empty($this->filesets)) {
|
||||
$filenames = array();
|
||||
foreach($this->filesets as $fs) {
|
||||
try {
|
||||
$ds = $fs->getDirectoryScanner($this->project);
|
||||
$filenames = $ds->getIncludedFiles(); // get included filenames
|
||||
$dir = $fs->getDir($this->project);
|
||||
foreach ($filenames as $fname) {
|
||||
$files[] = new PhingFile($dir, $fname);
|
||||
}
|
||||
} catch (BuildException $be) {
|
||||
$this->log($be->getMessage(), Project::MSG_WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objZip = new ZipArchive();
|
||||
if ($objZip->open($this->destinationFile, ZIPARCHIVE::OVERWRITE) !== true) {
|
||||
throw new Exeption("Could not open " . $strResultingFile . " for writing!");
|
||||
}
|
||||
|
||||
$this->log("Creating ZIP archive of " . count($files) . " files...");
|
||||
|
||||
foreach($files as $file) {
|
||||
$this->log("Processing file " . $this->_cleanFileName($file) . " ...");
|
||||
$contents = file_get_contents($file);
|
||||
$objZip->addFromString( $this->_cleanFileName($file), $contents );
|
||||
}
|
||||
|
||||
$objZip->close();
|
||||
|
||||
$this->log("Created ZIP archive " . $this->destinationFile . '.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup a filename
|
||||
*
|
||||
* @param string $strFile Filename
|
||||
* @return string Filename
|
||||
*/
|
||||
protected function _cleanFileName($strFile) {
|
||||
$strFile = str_replace('../', '', $strFile);
|
||||
$strFile = str_replace('.\\build\\', '', $strFile);
|
||||
$strFile = str_replace('WINDOWS', '', $strFile);
|
||||
|
||||
while (preg_match('/\/\//i', $strFile)) {
|
||||
$strFile = str_replace('//', '/', $strFile);
|
||||
}
|
||||
|
||||
return $strFile;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</adhoc-task>
|
||||
|
||||
<target name="prepare">
|
||||
<echo msg="Creating build directory: ./build" />
|
||||
<mkdir dir="./build" />
|
||||
<target name="prepare" depends="gather">
|
||||
<echo msg="Creating build directory: ./build"/>
|
||||
<mkdir dir="${phing.dir}/build"/>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="prepare">
|
||||
<echo msg="Copying source files to build directory..." />
|
||||
<echo msg="Copying source files to build directory..."/>
|
||||
|
||||
<copy todir="./build/Classes" overwrite="true">
|
||||
<fileset dir="../Classes">
|
||||
<include name="**/*" />
|
||||
<exclude name="**/.svn" />
|
||||
<copy todir="${phing.dir}/build/Classes" overwrite="true">
|
||||
<fileset dir="${phing.dir}/../Classes">
|
||||
<include name="**/*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<copy todir="./build/Documentation" overwrite="true">
|
||||
<fileset dir="../Documentation">
|
||||
<include name="*.${documentFormat}" />
|
||||
<include name="*.txt" />
|
||||
<exclude name="**/.svn" />
|
||||
<copy todir="${phing.dir}/build/Documentation" overwrite="true">
|
||||
<fileset dir="${phing.dir}/../Documentation">
|
||||
<include name="*.${documentFormat}"/>
|
||||
<include name="*.txt"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<mkdir dir="./build/Documentation/API" />
|
||||
<mkdir dir="${phing.dir}/build/Documentation/API"/>
|
||||
|
||||
<copy todir="./build/Documentation/Examples" overwrite="true">
|
||||
<fileset dir="../Documentation/Examples">
|
||||
<include name="**/*" />
|
||||
<exclude name="assets" />
|
||||
<exclude name="**/.svn" />
|
||||
<copy todir="${phing.dir}/build/Documentation/Examples" overwrite="true">
|
||||
<fileset dir="${phing.dir}/../Documentation/Examples">
|
||||
<include name="**/*"/>
|
||||
<exclude name="assets"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<copy todir="./build/Tests" overwrite="true">
|
||||
<fileset dir="../Tests">
|
||||
<include name="**/*" />
|
||||
<exclude name="**/.svn" />
|
||||
<copy todir="${phing.dir}/build/unitTests" overwrite="true">
|
||||
<fileset dir="${phing.dir}/../unitTests">
|
||||
<include name="**/*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<copy file="../changelog.txt" tofile="./build/changelog.txt" overwrite="true" />
|
||||
<copy file="../license.md" tofile="./build/license.txt" overwrite="true" />
|
||||
<copy file="../install.txt" tofile="./build/install.txt" overwrite="true" />
|
||||
<copy file="${phing.dir}/../changelog.txt" tofile="${phing.dir}/build/changelog.txt" overwrite="true"/>
|
||||
<copy file="${phing.dir}/../license.md" tofile="${phing.dir}/build/license.txt" overwrite="true"/>
|
||||
<copy file="${phing.dir}/../install.txt" tofile="${phing.dir}/build/install.txt" overwrite="true"/>
|
||||
</target>
|
||||
|
||||
<target name="versionNumber" depends="build">
|
||||
<reflexive>
|
||||
<fileset dir="./build">
|
||||
<include pattern="**/*" />
|
||||
<fileset dir="${phing.dir}/build">
|
||||
<include pattern="**/*"/>
|
||||
</fileset>
|
||||
<filterchain>
|
||||
<replaceregexp>
|
||||
|
@ -145,8 +82,8 @@
|
|||
</reflexive>
|
||||
|
||||
<reflexive>
|
||||
<fileset dir="./build">
|
||||
<include pattern="**/changelog.txt" />
|
||||
<fileset dir="${phing.dir}/build">
|
||||
<include pattern="**/changelog.txt"/>
|
||||
</fileset>
|
||||
<filterchain>
|
||||
<replaceregexp>
|
||||
|
@ -157,45 +94,73 @@
|
|||
</target>
|
||||
|
||||
<target name="apidocs" depends="versionNumber">
|
||||
<echo msg="Generating API documentation..." />
|
||||
<echo msg="Generating API documentation..."/>
|
||||
<phpdoc title="PHPExcel classes"
|
||||
destdir="./build/Documentation/API"
|
||||
destdir="${phing.dir}/build/Documentation/API"
|
||||
sourcecode="true"
|
||||
output="HTML:Smarty:PHP"
|
||||
defaultcategoryname="PHPExcel"
|
||||
defaultpackagename="PHPExcel"
|
||||
pear="true">
|
||||
<fileset dir="./build/Classes">
|
||||
<include name="**/*.php" />
|
||||
<fileset dir="${phing.dir}/build/Classes">
|
||||
<include name="**/*.php"/>
|
||||
</fileset>
|
||||
</phpdoc>
|
||||
</target>
|
||||
|
||||
<target name="release-standard" depends="apidocs">
|
||||
<mkdir dir="./release" />
|
||||
<mkdir dir="${phing.dir}/release"/>
|
||||
|
||||
<echo msg="Creating release package (v${packageVersion} with ${documentFormat} documents)..." />
|
||||
<phpzip destfile="./release/PHPExcel_${packageVersion}_${documentFormat}.zip">
|
||||
<fileset dir="./build">
|
||||
<include name="**/*" />
|
||||
<echo msg="Creating release package (v${packageVersion} with ${documentFormat} documents)..."/>
|
||||
<zip destfile="${phing.dir}/release/PHPExcel_${packageVersion}_${documentFormat}.zip">
|
||||
<fileset dir="${phing.dir}/build">
|
||||
<include name="**/*"/>
|
||||
</fileset>
|
||||
</phpzip>
|
||||
</zip>
|
||||
|
||||
<echo msg="Cleaning build directory: ./build" />
|
||||
<delete dir="./build" />
|
||||
<echo msg="Cleaning build directory: ./build"/>
|
||||
<delete dir="${phing.dir}/build"/>
|
||||
</target>
|
||||
|
||||
<target name="release-phar" depends="versionNumber">
|
||||
<mkdir dir="${phing.dir}/release"/>
|
||||
|
||||
<echo msg="Creating PHAR release package (v${packageVersion})..."/>
|
||||
<pharpackage destfile="${phing.dir}/release/PHPExcel_${packageVersion}.phar" basedir="${phing.dir}/build/Classes" compression="gzip" stub="${phing.dir}/PharStub.php">
|
||||
<fileset dir="${phing.dir}/build/Classes">
|
||||
<include name="**/**" />
|
||||
</fileset>
|
||||
<metadata>
|
||||
<element name="version" value="${packageVersion}" />
|
||||
<element name="date" value="${releaseDate}" />
|
||||
<element name="description" value="A pure PHP library for reading and writing spreadsheet files" />
|
||||
<element name="authors">
|
||||
<element name="Mark Baker">
|
||||
<element name="e-mail" value="mbaker@inviqa.com" />
|
||||
</element>
|
||||
</element>
|
||||
</metadata>
|
||||
</pharpackage>
|
||||
|
||||
<echo msg="Cleaning build directory: ./build"/>
|
||||
<delete dir="${phing.dir}/build"/>
|
||||
</target>
|
||||
|
||||
<target name="release-pear" depends="versionNumber">
|
||||
<mkdir dir="./release" />
|
||||
<mkdir dir="${phing.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="${phing.dir}/build/Classes" baseinstalldir="PHPExcel">
|
||||
<name>PHPExcel</name>
|
||||
<summary>PHP Excel classes</summary>
|
||||
<channel>pear.pearplex.net</channel>
|
||||
<description>Project providing a set of classes for the PHP programming language, which allow you to write to Excel 2007 files and read from Excel 2007 files.</description>
|
||||
<notes>This package ONLY contains the class files, not the documentation and example code. Please refer to http://www.codeplex.com/PHPExcel for those files.</notes>
|
||||
<channel>pear.php.net</channel>
|
||||
<description>Project providing a set of classes for the PHP programming language, which allow you to write
|
||||
to Excel 2007 files and read from Excel 2007 files.
|
||||
</description>
|
||||
<notes>This package ONLY contains the class files, not the documentation and example code. Please refer to
|
||||
http://www.codeplex.com/PHPExcel for those files.
|
||||
</notes>
|
||||
<lead user="maartenba" name="Maarten Balliauw" email="maarten@phpexcel.net"/>
|
||||
<license uri="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt">LGPL</license>
|
||||
<version release="${packageVersion}" api="${packageVersion}"/>
|
||||
|
@ -210,40 +175,37 @@
|
|||
<dirroles key="/PHPExcel/Shared/PDF/fonts/utils">data</dirroles>
|
||||
</d51pearpkg2>
|
||||
|
||||
<exec command="pear package ./build/Classes/package.xml"/>
|
||||
<move file="PHPExcel-${packageVersion}.tgz" tofile="release/PHPExcel-${packageVersion}.tgz" overwrite="true"/>
|
||||
<exec command="pear package ${phing.dir}/build/Classes/package.xml"/>
|
||||
<move file="PHPExcel-${packageVersion}.tgz" tofile="${phing.dir}/release/PHPExcel-${packageVersion}.tgz" overwrite="true"/>
|
||||
|
||||
<echo msg="Cleaning build directory: ./build" />
|
||||
<delete dir="./build" />
|
||||
<echo msg="Cleaning build directory: ./build"/>
|
||||
<delete dir="${phing.dir}/build"/>
|
||||
</target>
|
||||
|
||||
<target name="release-documentation">
|
||||
<mkdir dir="./release" />
|
||||
<mkdir dir="${phing.dir}/release"/>
|
||||
|
||||
<echo msg="Creating documentation release (v${packageVersion} with ${documentFormat} documents)..." />
|
||||
<copy todir="./build" overwrite="true">
|
||||
<fileset dir="../Documentation">
|
||||
<include name="*.${documentFormat}" />
|
||||
<include name="*.txt" />
|
||||
<exclude name="**/.svn" />
|
||||
<echo msg="Creating documentation release (v${packageVersion} with ${documentFormat} documents)..."/>
|
||||
<copy todir="${phing.dir}/build" overwrite="true">
|
||||
<fileset dir="${phing.dir}/../Documentation">
|
||||
<include name="*.${documentFormat}"/>
|
||||
<include name="*.txt"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="./build/Examples" overwrite="true">
|
||||
<fileset dir="../Documentation/Examples">
|
||||
<include name="**/*" />
|
||||
<exclude name="**/.svn" />
|
||||
<copy todir="${phing.dir}/build/Examples" overwrite="true">
|
||||
<fileset dir="${phing.dir}/../Documentation/Examples">
|
||||
<include name="**/*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<echo msg="Creating documentation release package (v${packageVersion} with ${documentFormat} documents)..." />
|
||||
<phpzip destfile="./release/PHPExcel_${packageVersion}-documentation_${documentFormat}.zip">
|
||||
<fileset dir="./build">
|
||||
<include name="**/*" />
|
||||
<exclude name="**/.svn" />
|
||||
<echo msg="Creating documentation release package (v${packageVersion} with ${documentFormat} documents)..."/>
|
||||
<zip destfile="${phing.dir}/release/PHPExcel_${packageVersion}-documentation_${documentFormat}.zip">
|
||||
<fileset dir="${phing.dir}/build">
|
||||
<include name="**/*"/>
|
||||
</fileset>
|
||||
</phpzip>
|
||||
</zip>
|
||||
|
||||
<echo msg="Cleaning build directory: ./build" />
|
||||
<delete dir="./build" />
|
||||
<echo msg="Cleaning build directory: ./build"/>
|
||||
<delete dir="${phing.dir}/build"/>
|
||||
</target>
|
||||
</project>
|
Loading…
Reference in New Issue