Changeset 1219 for trunk/buildscripts
- Timestamp:
- 06/30/2006 01:41:56 PM (2 years ago)
- Location:
- trunk/buildscripts
- Files:
-
- 2 modified
- 2 copied
-
classtree/DWExtension.php (copied) (copied from branches/3.0/buildscripts/classtree/DWExtension.php)
-
classtree/DWExtensionReadme.txt (copied) (copied from branches/3.0/buildscripts/classtree/DWExtensionReadme.txt)
-
classtree/build.php (modified) (5 diffs)
-
texbuilder/pages.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/buildscripts/classtree/build.php
r1167 r1219 1 1 <?php 2 2 3 $rootPath=dirname(__FILE__).'/../../framework'; 4 require_once($rootPath.'/prado.php'); 3 $basePath=dirname(__FILE__); 4 $frameworkPath=realpath($basePath.'/../../framework'); 5 require_once($frameworkPath.'/prado.php'); 6 require_once($basePath.'/DWExtension.php'); 7 5 8 $exclusions=array( 6 9 'prado.php', … … 12 15 '/3rdParty', 13 16 ); 14 $a=new ClassTreeBuilder($ rootPath,$exclusions);17 $a=new ClassTreeBuilder($frameworkPath,$exclusions); 15 18 $a->buildTree(); 16 $a->saveToFile('classes.data'); 19 $a->saveToFile($basePath.'/classes.data'); 20 $a->saveAsDWExtension($basePath); 17 21 18 22 class ClassTreeBuilder 19 23 { 20 24 const REGEX_RULES='/^\s*(abstract\s+)?class\s+(\w+)(\s+extends\s+(\w+)\s*|\s*)/msS'; 21 private $_ basePath;25 private $_frameworkPath; 22 26 private $_exclusions; 23 27 private $_classes=array(); 24 28 25 public function __construct($ basePath,$exclusions)26 { 27 $this->_ basePath=realpath($basePath);29 public function __construct($frameworkPath,$exclusions) 30 { 31 $this->_frameworkPath=realpath($frameworkPath); 28 32 $this->_exclusions=array(); 29 33 foreach($exclusions as $exclusion) 30 34 { 31 35 if($exclusion[0]==='/') 32 $this->_exclusions[realpath($ basePath.'/'.$exclusion)]=true;36 $this->_exclusions[realpath($frameworkPath.'/'.$exclusion)]=true; 33 37 else 34 38 $this->_exclusions[$exclusion]=true; … … 38 42 public function buildTree() 39 43 { 40 $sourceFiles=$this->getSourceFiles($this->_ basePath);44 $sourceFiles=$this->getSourceFiles($this->_frameworkPath); 41 45 foreach($sourceFiles as $sourceFile) 42 46 $this->parseFile($sourceFile); … … 74 78 { 75 79 include_once($sourceFile); 76 $classFile=strtr(substr($sourceFile,strlen($this->_ basePath)),'\\','/');80 $classFile=strtr(substr($sourceFile,strlen($this->_frameworkPath)),'\\','/'); 77 81 echo "Parsing $classFile...\n"; 78 82 $content=file_get_contents($sourceFile); … … 176 180 } 177 181 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 ''; 180 251 } 181 252 } -
trunk/buildscripts/texbuilder/pages.php
r1090 r1219 51 51 'Controls/Literal.page', 52 52 'Controls/MultiView.page', 53 'Controls/Pager.page', 53 54 'Controls/Panel.page', 54 55 'Controls/PlaceHolder.page',
