root/branches/2.3/bin/phing.php

Revision 323, 1.5 kB (checked in by hans, 1 year ago)

Refs #201 - Added improved support for arg parsing in Phing::execute() as well as better error handling between phing.php CLI script and Phing class.

  • Property svn:keywords set to author date id revision
Line 
1 <?php
2
3 /**
4  * This is the Phing command line launcher. It starts up the system evironment
5  * tests for all important paths and properties and kicks of the main command-
6  * line entry point of phing located in phing.Phing
7  * @version $Revision: 1.7 $
8  */
9  
10 // Set any INI options for PHP
11 // ---------------------------
12
13 /* set classpath */
14 if (getenv('PHP_CLASSPATH')) {
15     if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH'getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); }
16     ini_set('include_path', PHP_CLASSPATH);
17 } else {
18     if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH'get_include_path()); }
19 }
20
21 require_once 'phing/Phing.php';
22
23 try {
24     
25     /* Setup Phing environment */
26     Phing::startup();
27
28     // Set phing.home property to the value from environment
29     // (this may be NULL, but that's not a big problem.)
30     Phing::setProperty('phing.home', getenv('PHING_HOME'));
31
32     // Grab and clean up the CLI arguments
33     $args = isset($argv) ? $argv : $_SERVER['argv']; // $_SERVER['argv'] seems to not work (sometimes?) when argv is registered
34     array_shift($args); // 1st arg is script name, so drop it
35     
36     // Invoke the commandline entry point
37     Phing::fire($args);
38     
39     // Invoke any shutdown routines.
40     Phing::shutdown();
41     
42 } catch (ConfigurationException $x) {
43     
44     Phing::printMessage($x);
45     exit(-1); // This was convention previously for configuration errors.
46     
47 } catch (Exception $x) {
48     
49     // Assume the message was already printed as part of the build and
50     // exit with non-0 error code.
51     
52     exit(1);
53     
54 }
55
56 ?>
Note: See TracBrowser for help on using the browser.