From 593371da62ad904989ec400d06085861354c2bba Mon Sep 17 00:00:00 2001 From: Maarten Balliauw Date: Wed, 19 Dec 2012 11:50:49 +0100 Subject: [PATCH] Updated build scripts --- Build/PharStub.php | 14 ++ Build/build-phar.php | 85 -------- Build/build-release-phar.bat | 2 + Build/build.xml | 398 ++++++++++++++++------------------- 4 files changed, 196 insertions(+), 303 deletions(-) create mode 100644 Build/PharStub.php delete mode 100644 Build/build-phar.php create mode 100644 Build/build-release-phar.bat diff --git a/Build/PharStub.php b/Build/PharStub.php new file mode 100644 index 00000000..570b9db0 --- /dev/null +++ b/Build/PharStub.php @@ -0,0 +1,14 @@ +getMessage()); + exit(1); +} + +__HALT_COMPILER(); \ No newline at end of file diff --git a/Build/build-phar.php b/Build/build-phar.php deleted file mode 100644 index d2e5063c..00000000 --- a/Build/build-phar.php +++ /dev/null @@ -1,85 +0,0 @@ - 'Mark Baker ', - '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' -getMessage()); - exit(1); - } - - __HALT_COMPILER(); -EOT -); -$phar->setMetadata($metaData); -$phar->compressFiles(Phar::GZ); - -echo "Complete.\n"; - -exit(); diff --git a/Build/build-release-phar.bat b/Build/build-release-phar.bat new file mode 100644 index 00000000..985945d0 --- /dev/null +++ b/Build/build-release-phar.bat @@ -0,0 +1,2 @@ +@ECHO OFF +phing -f build.xml release-phar \ No newline at end of file diff --git a/Build/build.xml b/Build/build.xml index 8bca9f8d..1c9bfb7f 100644 --- a/Build/build.xml +++ b/Build/build.xml @@ -1,249 +1,211 @@ - + - - - + + + + + + + - - + + + + + - 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 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; - } - } - ]]> - + + - - - - + + + + + + - - + + + - - - - - - + + - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - + + + - - - - - - + + - - - - + - - - - - - - - - - - - + + PHPExcel + PHP Excel classes + pear.php.net + 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. + + This package ONLY contains the class files, not the documentation and example code. Please refer to + http://www.codeplex.com/PHPExcel for those files. + + + LGPL + + + + + + + + data + data + data + - - - - - - - - - - - + + - - - - - - - - + + + - - + + - - - - - - + + + + + + + + + + + + - - - + + + + + + - - - - - - - PHPExcel - PHP Excel classes - pear.pearplex.net - 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. - This package ONLY contains the class files, not the documentation and example code. Please refer to http://www.codeplex.com/PHPExcel for those files. - - LGPL - - - - - - - - data - data - data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + \ No newline at end of file