Changeset 307

Show
Ignore:
Timestamp:
11/15/07 13:17:47 (8 months ago)
Author:
hans
Message:

Refs #188 - Adding work-in-progress (still-broken!) namespace support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bin/phing

    r151 r307  
    8181fi 
    8282 
    83 phing_exec_cmd="exec $PHP_COMMAND -d html_errors=off -qC \"$PHING_HOME/bin/phing.php\" -logger phing.listener.AnsiColorLogger $phing_exec_args" 
     83phing_exec_cmd="exec $PHP_COMMAND -d html_errors=off -qC \"$PHING_HOME/bin/phing.php\" -logger phing::listener::AnsiColorLogger $phing_exec_args" 
    8484if $phing_exec_debug ; then 
    8585  echo $phing_exec_cmd 
  • trunk/bin/phing.php

    r123 r307  
    2323require_once 'phing/Phing.php'; 
    2424 
     25spl_autoload_register(array('phing::Phing', 'autoload')); 
     26 
    2527/* Setup Phing environment */ 
    26 Phing::startup(); 
     28phing::Phing::startup(); 
    2729 
    2830/*  
     
    3133   which is fine (I think).  Nothing uses phing.home right now. 
    3234*/ 
    33 Phing::setProperty('phing.home', getenv('PHING_HOME')); 
     35phing::Phing::setProperty('phing.home', getenv('PHING_HOME')); 
    3436 
    3537 
     
    3941 
    4042/* fire main application */ 
    41 Phing::fire($args); 
     43phing::Phing::fire($args); 
    4244 
    4345/* 
     
    4547   -- basically we should not need this due to register_shutdown_function in Phing 
    4648 */ 
    47  Phing::halt(0); 
     49phing::Phing::halt(0); 
    4850 
    4951?> 
  • trunk/classes/phing/BuildEvent.php

    r173 r307  
    2020 */ 
    2121 
    22 require_once 'phing/system/lang/EventObject.php'
     22namespace phing
    2323 
    2424/** 
     
    4141 * @package   phing 
    4242 */ 
    43 class BuildEvent extends EventObject { 
    44  
     43class BuildEvent { 
     44 
     45        /** 
     46         * The object on which the Event initially occurred. 
     47         * @var object 
     48         */ 
     49    protected $source; 
     50     
    4551    /** 
    4652     * A reference to the project 
     
    8995     */ 
    9096    public function __construct($source) { 
    91         parent::__construct($source)
     97        $this->source = $source
    9298        if ($source instanceof Project) { 
    9399            $this->project = $source; 
     
    196202        return $this->exception; 
    197203    } 
     204     
     205        /** 
     206         * Get the object on which the Event initially occurred. 
     207         * @return object 
     208         */ 
     209    public function getSource() { 
     210        return $this->source; 
     211    } 
     212 
     213    /** 
     214         * Returns a String representation of this EventObject. 
     215         * @return string 
     216         */ 
     217    public function __toString() { 
     218        if (method_exists($this->source, "toString")) { 
     219            return get_class($this)."[source=".$this->source->toString()."]"; 
     220        } else { 
     221            return get_class($this)."[source=".get_class($this->source)."]"; 
     222        } 
     223    } 
     224     
     225    /** 
     226     * 
     227     * @deprecated 
     228     */ 
     229    public function toString() { 
     230        return $this->__toString(); 
     231    } 
     232     
    198233} 
  • trunk/classes/phing/BuildException.php

    r290 r307  
    1919 * <http://phing.info>.  
    2020 */ 
     21 
     22namespace phing; 
     23use phing::parser::Location; 
    2124 
    2225/** 
  • trunk/classes/phing/ConfigurationException.php

    r290 r307  
    1919 * <http://phing.info>. 
    2020 */ 
     21 
     22namespace phing; 
    2123 
    2224/** 
  • trunk/classes/phing/IntrospectionHelper.php

    r144 r307  
    11<?php 
    2  
    32/* 
    43 *  $Id$ 
     
    2120 */ 
    2221 
    23 include_once 'phing/types/Reference.php'
    24 include_once 'phing/types/Path.php'
    25 include_once 'phing/util/StringHelper.php'; 
     22namespace phing
     23use phing::util::StringHelper
     24 
    2625 
    2726/** 
     
    321320                } 
    322321                 
    323                 // does method expect a PhingFile object? if so, then  
     322                // does method expect a File object? if so, then  
    324323                // pass a project-relative file. 
    325324                $params = $method->getParameters(); 
     
    333332                // there should only be one param; we'll just assume .... 
    334333                if ($classname !== null) { 
    335                     switch(strtolower($classname)) { 
    336                         case "phingfile": 
     334                    switch($classname) { 
     335                        case "phing::system::io::File": 
    337336                            $value = $project->resolveFile($value); 
    338337                            break; 
    339                         case "path": 
     338                        case "phing::types::Path": 
    340339                            $value = new Path($project, $value); 
    341340                            break; 
    342                         case "reference": 
     341                        case "phing::types::Reference": 
    343342                            $value = new Reference($value); 
    344343                            break;             
  • trunk/classes/phing/Phing.php

    r296 r307  
    2020 */ 
    2121 
    22 require_once 'phing/Project.php'; 
    23 require_once 'phing/ProjectComponent.php'; 
    24 require_once 'phing/Target.php'; 
    25 require_once 'phing/Task.php'; 
    26  
    27 include_once 'phing/BuildException.php'; 
    28 include_once 'phing/ConfigurationException.php'; 
    29 include_once 'phing/BuildEvent.php'; 
    30  
    31 include_once 'phing/parser/Location.php'; 
    32 include_once 'phing/parser/ExpatParser.php'; 
    33 include_once 'phing/parser/AbstractHandler.php'; 
    34 include_once 'phing/parser/ProjectConfigurator.php'; 
    35 include_once 'phing/parser/RootHandler.php'; 
    36 include_once 'phing/parser/ProjectHandler.php'; 
    37 include_once 'phing/parser/TaskHandler.php'; 
    38 include_once 'phing/parser/TargetHandler.php'; 
    39 include_once 'phing/parser/DataTypeHandler.php'; 
    40 include_once 'phing/parser/NestedElementHandler.php'; 
    41  
    42 include_once 'phing/system/util/Properties.php'; 
    43 include_once 'phing/util/StringHelper.php'; 
    44 include_once 'phing/system/io/PhingFile.php'; 
    45 include_once 'phing/system/io/OutputStream.php'; 
    46 include_once 'phing/system/io/FileOutputStream.php'; 
    47 include_once 'phing/system/io/FileReader.php'; 
    48 include_once 'phing/system/util/Register.php'; 
     22namespace phing; 
     23use phing::system::io::OutputStream; 
     24use phing::system::util::Properties; 
     25use phing::util::StringHelper; 
     26use phing::system::io::File; 
     27use phing::system::io::FileReader; 
    4928 
    5029/** 
     
    7049        private static $msgOutputLevel = Project::MSG_INFO; 
    7150 
    72         /** PhingFile that we are using for configuration */ 
     51        /** File that we are using for configuration */ 
    7352        private $buildFile = null; 
    7453 
     
    128107         */ 
    129108        private static $isLogFileUsed = false; 
    130  
     109         
     110        /** 
     111         * Enter description here... 
     112         * 
     113         * @param string $clazz Class that was requested. 
     114         */ 
     115        public static function autoload($clazz) 
     116        { 
     117                 
     118                 
     119                $file = str_replace('::', DIRECTORY_SEPARATOR, $clazz) . '.php'; 
     120                 
     121                foreach(explode(PATH_SEPARATOR, get_include_path()) as $path) { 
     122                        if (is_readable($path . DIRECTORY_SEPARATOR . $file)) { 
     123                                // print "Autloaded: $file\n"; 
     124                                require $path . DIRECTORY_SEPARATOR . $file; 
     125                                return true; 
     126                        } 
     127                } 
     128                 
     129                print "Failed to autoload: " . $clazz . "\n"; 
     130                // print new Exception('trace'); 
     131                 
     132                return false; 
     133        } 
     134         
    131135        /** 
    132136         * Entry point allowing for more options from other front ends. 
     
    307311                                                throw new ConfigurationException($msg); 
    308312                                        } else { 
    309                                                 $logFile = new PhingFile($args[++$i]); 
     313                                                $logFile = new File($args[++$i]); 
    310314                                                $out = new FileOutputStream($logFile); // overwrite 
    311315                                                self::setOutputStream($out); 
     
    322326                                        throw new ConfigurationException($msg); 
    323327                                } else { 
    324                                         $this->buildFile = new PhingFile($args[++$i]); 
     328                                        $this->buildFile = new File($args[++$i]); 
    325329                                } 
    326330                        } elseif ($arg == "-listener") { 
     
    386390                                $this->buildFile = $this->_findBuildFile(self::getProperty("user.dir"), $this->searchForThis); 
    387391                        } else { 
    388                                 $this->buildFile = new PhingFile(self::DEFAULT_BUILD_FILENAME); 
     392                                $this->buildFile = new File(self::DEFAULT_BUILD_FILENAME); 
    389393                        } 
    390394                } 
     
    405409         * Helper to get the parent file for a given file. 
    406410         * 
    407          * @param PhingFile $file 
    408          * @return PhingFile Parent file or null if none 
    409          */ 
    410         private function _getParentFile(PhingFile $file) { 
     411         * @param File $file&