Changeset 14

Show
Ignore:
Timestamp:
02/11/06 21:18:15 (3 years ago)
Author:
hans
Message:
  • Completed Phing-specific PEAR build task
  • Added new PEAR build.xml file
  • Removed old PEAR build.xml file
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pear/BuildPhingPEARPackageTask.php

    r10 r14  
    3737        private $version; 
    3838        private $state = 'stable'; 
    39  
     39        private $notes; 
     40         
     41        private $filesets = array(); 
     42         
    4043    /** Package file */ 
    4144    private $packageFile; 
     
    6265                $options['phing_project'] = $this->getProject(); 
    6366                $options['phing_filesets'] = $this->filesets; 
    64  
     67                 
     68                if ($this->packageFile !== null) { 
     69            // create one w/ full path 
     70            $f = new PhingFile($this->packageFile->getAbsolutePath()); 
     71            $options['packagefile'] = $f->getName(); 
     72            // must end in trailing slash 
     73            $options['outputdirectory'] = $f->getParent() . DIRECTORY_SEPARATOR; 
     74            $this->log("Creating package file: " . $f->getPath(), PROJECT_MSG_INFO); 
     75        } else { 
     76            $this->log("Creating [default] package.xml file in base directory.", PROJECT_MSG_INFO); 
     77        } 
     78                 
    6579                // add install exceptions 
    6680                $options['installexceptions'] = array(  'bin/phing.php' => '/', 
     
    7185                $options['dir_roles'] = array(  'phing_guide' => 'doc', 
    7286                                                                                'etc' => 'data', 
    73                                                                                 'example' => 'doc'))
     87                                                                                'example' => 'doc')
    7488 
    7589                $options['exceptions'] = array( 'bin/pear-phing.bat' => 'script', 
    7690                                                                                'bin/pear-phing' => 'script', 
    7791                                                                                'CREDITS' => 'doc', 
    78                                                                                 'INSTALL.UNIX' => 'doc', 
    79                                                                                 'INSTALL.WIN32' => 'doc', 
    8092                                                                                'CHANGELOG' => 'doc', 
    8193                                                                                'README' => 'doc', 
     
    106118                // the hard-coded stuff 
    107119                $package->setPackage('phing'); 
    108                 $package->setSummary(''); 
    109                 $package->setDescription(''); 
    110                 $package->setChannel('phing.info'); 
     120                $package->setSummary('PHP5 project build system based on Apache Ant'); 
     121                $package->setDescription('PHing Is Not GNU make; it\'s a project build system based on Apache Ant.  
     122You can do anything with it that you could do with a traditional build system like GNU make, and its use of  
     123simple XML build files and extensible PHP "task" classes make it an easy-to-use and highly flexible build framework.  
     124Features include file transformations (e.g. token replacement, XSLT transformation, Smarty template transformations,  
     125etc.), file system operations, interactive build support, SQL execution, and much more.'); 
     126                $package->setChannel('pear.phing.info'); 
    111127                $package->setPackageType('php'); 
    112128 
    113129                $package->setReleaseVersion($this->version); 
     130                $package->setAPIVersion($this->version); 
     131                 
    114132                $package->setReleaseStability($this->state); 
    115  
     133                $package->setAPIStability($this->state); 
     134                 
     135                $package->setNotes($this->notes); 
     136                 
     137                $package->setLicense('LGPL', 'http://www.gnu.org/licenses/lgpl.html'); 
     138                 
     139                // Add package maintainers 
     140                $package->addMaintainer('lead', 'hans', 'Hans Lellelid', 'hans@xmpl.org'); 
     141                $package->addMaintainer('lead', 'mrook', 'Michiel Rook', 'michiel@trendserver.nl'); 
     142                 
     143                 
     144                 
    116145                // (wow ... this is a poor design ...) 
    117                 $package->addRelease(); 
    118                 $package->setOSInstallCondition('windows'); 
    119                 $package->addInstallAs('bin/pear-phing.bat', 'phing.bat'); 
    120                 $package->addIgnore('bin/pear-phing'); 
    121  
    122                 $package->addRelease(); 
    123                 $package->addInstallAs('bin/pear-phing', 'phing'); 
    124                 $package->addIgnore('pear-phpdoc.bat'); 
    125  
    126                 $package->addInstallAs('bin/phing.php', 'phing.php'); 
    127  
    128                 // dependencies 
     146                // 
     147                // note that the order of the method calls below is creating 
     148                // sub-"release" sections which have specific rules.  This replaces 
     149                // the platformexceptions system in the older version of PEAR's package.xml 
     150                // 
     151                // Programmatically, I feel the need to re-iterate that this API for PEAR_PackageFileManager 
     152                // seems really wrong.  Sub-sections should be encapsulated in objects instead of having 
     153                // a "flat" API that does not represent the structure being created.... 
     154                 
     155                 
     156                // creating a sub-section for 'windows' 
     157                        $package->addRelease(); 
     158                        $package->setOSInstallCondition('windows'); 
     159                        $package->addInstallAs('bin/phing.php', 'phing.php'); 
     160                        $package->addInstallAs('bin/pear-phing.bat', 'phing.bat'); 
     161                        $package->addIgnoreToRelease('bin/pear-phing'); 
     162                 
     163                // creating a sub-section for non-windows 
     164                        $package->addRelease(); 
     165                        //$package->setOSInstallCondition('(*ix|*ux|darwin*|*BSD|SunOS*)'); 
     166                        $package->addInstallAs('bin/phing.php', 'phing.php'); 
     167                        $package->addInstallAs('bin/pear-phing', 'phing'); 
     168                        $package->addIgnoreToRelease('bin/pear-phing.bat'); 
     169                 
     170 
     171                // "core" dependencies 
    129172                $package->setPhpDep('5.0.0'); 
    130173                $package->setPearinstallerDep('1.4.0'); 
    131  
     174                 
     175                // "package" dependencies 
     176                $package->addPackageDepWithChannel( 'optional', 'VersionControl_SVN', 'pear.php.net', '0.3.0alpha1'); 
     177                $package->addPackageDepWithChannel( 'optional', 'PHPUnit2', 'pear.php.net', '2.3.0'); 
     178                $package->addPackageDepWithChannel( 'optional', 'PhpDocumentor', 'pear.php.net', '1.3.0RC3'); 
     179                $package->addPackageDepWithChannel( 'optional', 'Xdebug', 'pear.php.net', '2.0.0beta2'); 
     180                $package->addPackageDepWithChannel( 'optional', 'Archive_Tar', 'pear.php.net', '1.3.0'); 
     181                $package->addPackageDepWithChannel( 'optional', 'PEAR_PackageFileManager', 'pear.php.net', '1.5.2'); 
     182 
     183                // now add the replacements .... 
     184                $package->addReplacement('Phing.php', 'pear-config', '@DATA-DIR@', 'data_dir'); 
     185                $package->addReplacement('bin/pear-phing.bat', 'pear-config', '@PHP-BIN@', 'php_bin'); 
     186                $package->addReplacement('bin/pear-phing.bat', 'pear-config', '@BIN-DIR@', 'bin_dir'); 
     187                $package->addReplacement('bin/pear-phing.bat', 'pear-config', '@PEAR-DIR@', 'php_dir'); 
     188                $package->addReplacement('bin/pear-phing', 'pear-config', '@PHP-BIN@', 'php_bin'); 
     189                $package->addReplacement('bin/pear-phing', 'pear-config', '@BIN-DIR@', 'bin_dir'); 
     190                $package->addReplacement('bin/pear-phing', 'pear-config', '@PEAR-DIR@', 'php_dir'); 
     191                 
     192                // now we run this weird generateContents() method that apparently  
     193                // is necessary before we can add replacements ... ? 
    132194                $package->generateContents(); 
    133  
    134                 // add replacements .... 
    135  
     195                 
    136196        $e = $package->writePackageFile(); 
    137197 
    138198        if (PEAR::isError($e)) { 
    139                         $bt = $e->getBacktrace(); 
    140                         foreach($bt as $b) { 
    141                                 print $b['file'] . " " . $b['line'] . "\n"; 
    142                         } 
    143199            throw new BuildException("Unable to write package file.", new Exception($e->getMessage())); 
    144200        } 
     
    182238     * @return void 
    183239     */ 
    184         public function setState($v)
     240        public function setState($v)
    185241                $this->state = $v; 
    186242        } 
    187  
     243         
     244        /** 
     245         * Sets release notes field. 
     246         * @param string $v 
     247         * @return void 
     248         */ 
     249        public function setNotes($v) { 
     250                $this->notes = $v; 
     251        } 
    188252    /** 
    189253     * Sets "dir" property from XML.