diff options
author | ctrlaltca <> | 2013-01-02 14:42:24 +0000 |
---|---|---|
committer | ctrlaltca <> | 2013-01-02 14:42:24 +0000 |
commit | edf2251aca60a970e822079d23933e5b70b26571 (patch) | |
tree | 366b6688efbb03f20f47268bea57859cea673c70 /buildscripts/phing/bin/phing.php | |
parent | 8e5f2510bd577e15095e46afc7d0ba6808549bf8 (diff) |
backported all related changes up to 3229 to branch/3.2
Diffstat (limited to 'buildscripts/phing/bin/phing.php')
-rwxr-xr-x[-rw-r--r--] | buildscripts/phing/bin/phing.php | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/buildscripts/phing/bin/phing.php b/buildscripts/phing/bin/phing.php index 7d0a774a..3b70887a 100644..100755 --- a/buildscripts/phing/bin/phing.php +++ b/buildscripts/phing/bin/phing.php @@ -4,51 +4,53 @@ * This is the Phing command line launcher. It starts up the system evironment * tests for all important paths and properties and kicks of the main command- * line entry point of phing located in phing.Phing - * @version $Revision: 1.7 $ + * @version $Id$ */ - + // Set any INI options for PHP // --------------------------- -ini_set('track_errors', 1); - /* set classpath */ -/* if (getenv('PHP_CLASSPATH')) { -// define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); - define('PHP_CLASSPATH', realpath(dirname(__FILE__).'/../classes') . PATH_SEPARATOR . get_include_path()); + if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); } ini_set('include_path', PHP_CLASSPATH); } else { - define('PHP_CLASSPATH', get_include_path()); + if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', get_include_path()); } } -*/ -define('PHP_CLASSPATH', realpath(dirname(__FILE__).'/../classes') . PATH_SEPARATOR . get_include_path()); -ini_set('include_path', PHP_CLASSPATH); require_once 'phing/Phing.php'; -/* Setup Phing environment */ -Phing::startup(); - -/* - find phing home directory - -- if Phing is installed from PEAR this will probably be null, - which is fine (I think). Nothing uses phing.home right now. -*/ -Phing::setProperty('phing.home', getenv('PHING_HOME')); - - -/* polish CLI arguments */ -$args = isset($argv) ? $argv : $_SERVER['argv']; // $_SERVER['argv'] seems not to work when argv is registered (PHP5b4) -array_shift($args); // 1st arg is script name, so drop it - -/* fire main application */ -Phing::fire($args); - -/* - exit OO system if not already called by Phing - -- basically we should not need this due to register_shutdown_function in Phing - */ - Phing::halt(0); +try { + + /* Setup Phing environment */ + Phing::startup(); + + // Set phing.home property to the value from environment + // (this may be NULL, but that's not a big problem.) + Phing::setProperty('phing.home', getenv('PHING_HOME')); + + // Grab and clean up the CLI arguments + $args = isset($argv) ? $argv : $_SERVER['argv']; // $_SERVER['argv'] seems to not work (sometimes?) when argv is registered + array_shift($args); // 1st arg is script name, so drop it + + // Invoke the commandline entry point + Phing::fire($args); + + // Invoke any shutdown routines. + Phing::shutdown(); + +} catch (ConfigurationException $x) { + + Phing::printMessage($x); + exit(-1); // This was convention previously for configuration errors. + +} catch (Exception $x) { + + // Assume the message was already printed as part of the build and + // exit with non-0 error code. + + exit(1); + +} -?>
\ No newline at end of file +?> |