try { $project = new Project(); // hax for Mac OS X 10.5 Leopard, where "dim" ANSI colors are broken... if (PHP_OS == 'Darwin' && (isset($_SERVER['TERM_PROGRAM']) && $_SERVER['TERM_PROGRAM'] == 'Apple_Terminal' || isset($_ENV['TERM_PROGRAM']) && $_ENV['TERM_PROGRAM'] == 'Apple_Terminal') && version_compare(preg_replace('/^ProductVersion:\\s*([0-9]+\\.[0-9]+)/ms', '$1', shell_exec('sw_vers')), '10.5', 'eq') && !Phing::getProperty('phing.logger.defaults')) { Phing::setProperty('phing.logger.defaults', new PhingFile(BUILD_DIRECTORY . '/agavi/phing/ansicolorlogger_osxleopard.properties')); } elseif (stripos(PHP_OS, 'Win') === 0) { $GLOBALS['LOGGER'] = 'phing.listener.DefaultLogger'; } $GLOBALS['LOGGER'] = Phing::import($GLOBALS['LOGGER']); $logger = new AgaviProxyBuildLogger(new $GLOBALS['LOGGER']()); $logger->setMessageOutputLevel($GLOBALS['VERBOSE'] ? Project::MSG_VERBOSE : Project::MSG_INFO); $logger->setOutputStream($GLOBALS['OUTPUT']); $logger->setErrorStream($GLOBALS['ERROR']); $project->addBuildListener($logger); $project->setInputHandler(new DefaultInputHandler()); $project->setUserProperty('phing.file', $GLOBALS['BUILD']->getAbsolutePath()); $project->setUserProperty('phing.version', Phing::getPhingVersion()); /* Phing f***s with the cwd. Really, brilliant. */ $project->setUserProperty('application.startdir', START_DIRECTORY); foreach ($GLOBALS['PROPERTIES'] as $name => $value) { $project->setUserProperty($name, $value); } $project->init(); ProjectConfigurator::configureProject($project, $GLOBALS['BUILD']); Phing::setCurrentProject($project); if ($GLOBALS['SHOW_LIST'] === true) { input_help_display(); $GLOBALS['OUTPUT']->write(PHP_EOL); $GLOBALS['OUTPUT']->write('Targets:' . PHP_EOL); $size = 0; $targets = array();
/** * Copies all user properties that have been set on the command * line or a GUI tool from this instance to the Project instance * given as the argument. * * <p>To copy all "user" properties, you will also have to call * {@link #copyInheritedProperties copyInheritedProperties}.</p> * * @param Project $other the project to copy the properties to. Must not be null. * @return void * @since phing 2.0 */ public function copyUserProperties(Project $other) { foreach ($this->userProperties as $arg => $value) { if (isset($this->inheritedProperties[$arg])) { continue; } $other->setUserProperty($arg, $value); } }
/** * Copies the configuration from the proxied project into this project. * * @author Noah Fontes <*****@*****.**> * @since 1.0.4 */ protected function copy() { foreach ($this->proxied->getBuildListeners() as $listener) { parent::addBuildListener($listener); } $this->setInputHandler($this->proxied->getInputHandler()); foreach ($this->proxied->getTaskDefinitions() as $name => $class) { parent::addTaskDefinition($name, $class); } foreach ($this->proxied->getDataTypeDefinitions() as $name => $class) { parent::addDataTypeDefinition($name, $class); } /* Assign properties for consistency. */ $this->proxied->copyUserProperties($this); $this->proxied->copyInheritedProperties($this); foreach ($this->proxied->getProperties() as $name => $property) { if (!AgaviProxyProject::isPropertyProtected($name) && $this->getProperty($name) === null) { parent::setNewProperty($name, $property); } } /* Add proxy targets to the new project. */ foreach ($this->proxied->getTargets() as $name => $target) { $proxy = new AgaviProxyTarget(); $proxy->setName($name); $proxy->setDescription($target->getDescription()); $proxy->setTarget($target); parent::addTarget($name, $proxy); } parent::setUserProperty('phing.version', $this->proxied->getProperty('phing.version')); $this->setSystemProperties(); }