123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
-
- require_once 'phing/Task.php';
- include_once 'phing/types/Path.php';
- class IncludePathTask extends Task {
-
-
- private $classname;
-
-
- private $classpath;
-
-
- private $classpathId;
-
-
- public function setClasspath(Path $classpath) {
- if ($this->classpath === null) {
- $this->classpath = $classpath;
- } else {
- $this->classpath->append($classpath);
- }
- }
-
-
- public function createClasspath() {
- if ($this->classpath === null) {
- $this->classpath = new Path($this->project);
- }
- return $this->classpath->createPath();
- }
-
- public function setClasspathRef(Reference $r) {
- $this->classpathId = $r->getRefId();
- $this->createClasspath()->setRefid($r);
- }
-
-
- public function main() {
-
-
- if (is_object($this->classpath)) {
- $this->classpath = $this->classpath->__toString();
- }
-
- if (empty($this->classpath)) {
- throw new BuildException("Provided classpath was empty.");
- }
-
- $curr_parts = explode(PATH_SEPARATOR, get_include_path());
- $add_parts = explode(PATH_SEPARATOR, $this->classpath);
- $new_parts = array_diff($add_parts, $curr_parts);
-
- if ($new_parts) {
- $this->log("Prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts), Project::MSG_VERBOSE);
- set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
- }
-
- }
- }
|