Changeset 1219 for trunk/buildscripts

Show
Ignore:
Timestamp:
06/30/2006 01:41:56 PM (2 years ago)
Author:
xue
Message:

Merge from 3.0 branch till 1218.

Location:
trunk/buildscripts
Files:
2 modified
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/buildscripts/classtree/build.php

    r1167 r1219  
    11<?php 
    22 
    3 $rootPath=dirname(__FILE__).'/../../framework'; 
    4 require_once($rootPath.'/prado.php'); 
     3$basePath=dirname(__FILE__); 
     4$frameworkPath=realpath($basePath.'/../../framework'); 
     5require_once($frameworkPath.'/prado.php'); 
     6require_once($basePath.'/DWExtension.php'); 
     7 
    58$exclusions=array( 
    69        'prado.php', 
     
    1215        '/3rdParty', 
    1316        ); 
    14 $a=new ClassTreeBuilder($rootPath,$exclusions); 
     17$a=new ClassTreeBuilder($frameworkPath,$exclusions); 
    1518$a->buildTree(); 
    16 $a->saveToFile('classes.data'); 
     19$a->saveToFile($basePath.'/classes.data'); 
     20$a->saveAsDWExtension($basePath); 
    1721 
    1822class ClassTreeBuilder 
    1923{ 
    2024        const REGEX_RULES='/^\s*(abstract\s+)?class\s+(\w+)(\s+extends\s+(\w+)\s*|\s*)/msS'; 
    21         private $_basePath; 
     25        private $_frameworkPath; 
    2226        private $_exclusions; 
    2327        private $_classes=array(); 
    2428 
    25         public function __construct($basePath,$exclusions) 
    26         { 
    27                 $this->_basePath=realpath($basePath); 
     29        public function __construct($frameworkPath,$exclusions) 
     30        { 
     31                $this->_frameworkPath=realpath($frameworkPath); 
    2832                $this->_exclusions=array(); 
    2933                foreach($exclusions as $exclusion) 
    3034                { 
    3135                        if($exclusion[0]==='/') 
    32                                 $this->_exclusions[realpath($basePath.'/'.$exclusion)]=true; 
     36                                $this->_exclusions[realpath($frameworkPath.'/'.$exclusion)]=true; 
    3337                        else 
    3438                                $this->_exclusions[$exclusion]=true; 
     
    3842        public function buildTree() 
    3943        { 
    40                 $sourceFiles=$this->getSourceFiles($this->_basePath); 
     44                $sourceFiles=$this->getSourceFiles($this->_frameworkPath); 
    4145                foreach($sourceFiles as $sourceFile) 
    4246                        $this->parseFile($sourceFile); 
     
    7478        { 
    7579                include_once($sourceFile); 
    76                 $classFile=strtr(substr($sourceFile,strlen($this->_basePath)),'\\','/'); 
     80                $classFile=strtr(substr($sourceFile,strlen($this->_frameworkPath)),'\\','/'); 
    7781                echo "Parsing $classFile...\n"; 
    7882                $content=file_get_contents($sourceFile); 
     
    176180        } 
    177181 
    178         public function saveAsTagLib($fileName) 
    179         { 
     182        public function saveAsDWExtension($basePath) 
     183        { 
     184                $tagPath=$basePath.'/Configuration/TagLibraries/PRADO'; 
     185 
     186                // prepare the directory to save tag lib 
     187                @mkdir($basePath.'/Configuration'); 
     188                @mkdir($basePath.'/Configuration/TagLibraries'); 
     189                @mkdir($basePath.'/Configuration/TagLibraries/PRADO'); 
     190 
     191                $docMXI = new PradoMXIDocument(Prado::getVersion()); 
     192                $tagChooser = new PradoTagChooser; 
     193 
     194                $controlClass = new ReflectionClass('TControl'); 
     195 
     196                foreach($this->_classes as $className=>$classInfo) 
     197                { 
     198                        $class = new ReflectionClass($className); 
     199                        if($class->isInstantiable() && ($className==='TControl' || $class->isSubclassOf($controlClass))) 
     200                        { 
     201                                $docMXI->addTag($className); 
     202                                $tagChooser->addElement($className); 
     203                                $docVTM = new PradoVTMDocument($className); 
     204                                foreach($classInfo['Properties'] as $name=>$property) 
     205                                { 
     206                                        $type=$property['type']; 
     207                                        if(isset($this->_classes[$type]) && ($type==='TFont' || strrpos($type,'Style')===strlen($type)-5 && $type!=='TStyle')) 
     208                                                $this->processObjectType($type,$this->_classes[$type],$name,$docVTM); 
     209                                        if($property['readonly'] || $property['protected']) 
     210                                                continue; 
     211                                        if(($type=$this->checkType($className,$name,$property['type']))!=='') 
     212                                                $docVTM->addAttribute($name,$type); 
     213                                } 
     214                                foreach($classInfo['Events'] as $name=>$event) 
     215                                { 
     216                                        $docVTM->addEvent($name); 
     217                                } 
     218                                file_put_contents($tagPath.'/'.$className.'.vtm',$docVTM->getXML()); 
     219                        } 
     220                } 
     221 
     222                file_put_contents($basePath.'/PRADO.mxi',$docMXI->getXML()); 
     223                file_put_contents($tagPath.'/TagChooser.xml',$tagChooser->getXML()); 
     224 
     225        } 
     226 
     227        private function processObjectType($objectType,$objectInfo,$prefix,$doc) 
     228        { 
     229                foreach($objectInfo['Properties'] as $name=>$property) 
     230                { 
     231                        if($property['type']==='TFont') 
     232                                $this->processObjectType('TFont',$this->_classes['TFont'],$prefix.'.'.$name,$doc); 
     233                        if($property['readonly'] || $property['protected']) 
     234                                continue; 
     235                        if(($type=$this->checkType($objectType,$name,$property['type']))!=='') 
     236                                $doc->addAttribute($prefix.'.'.$name,$type); 
     237                } 
     238        } 
     239 
     240        private function checkType($className,$propertyName,$type) 
     241        { 
     242                if(strrpos($propertyName,'Color')===strlen($propertyName)-5) 
     243                        return 'color'; 
     244                if($propertyName==='Style') 
     245                        return 'style'; 
     246                if($type==='boolean') 
     247                        return array('true','false'); 
     248                if($type==='string' || $type==='integer' || $type==='ITemplate') 
     249                        return 'text'; 
     250                return ''; 
    180251        } 
    181252} 
  • trunk/buildscripts/texbuilder/pages.php

    r1090 r1219  
    5151        'Controls/Literal.page', 
    5252        'Controls/MultiView.page', 
     53        'Controls/Pager.page', 
    5354        'Controls/Panel.page', 
    5455        'Controls/PlaceHolder.page',