@param Path $classpath

@throws \BuildException
777867
public function setClasspath(Path $classpath): void
    {
        if ($this->classpath === null) {
            $this->classpath = $classpath;
        } else {
            $this->classpath->append($classpath);
        }
    }
589824
public function buildXMLConfig(array $classesMetadata, string $path)
    {
        foreach ($classesMetadata as $alias => $classMetadata) {
            $dom = new \DOMDocument("1.0", "utf-8");
            $dom->preserveWhiteSpace = false;
            $dom->formatOutput = true;
            $root = $dom->createElement("dependencies");
            $dom->appendChild($root);

            // Build alias from class name if missing
            $alias = $alias ?? strtolower(str_replace('\\', '_', $classMetadata->className));

            $classData = $dom->createElement('instance');
            $classData->setAttribute('service', $alias);
            $classData->setAttribute('class', $classMetadata->className);

            foreach ($classMetadata->scopes as $scope) {
                $classData->setAttribute('scope', $scope);
            }

            $methodsData = $dom->createElement('methods');
            foreach ($classMetadata->methodsMetadata as $method => $methodMetadata) {
                if (count($methodMetadata->dependencies)) {
                    $methodData = $dom->createElement($method);
                    $argumentsData = $dom->createElement('arguments');
                    foreach ($methodMetadata->dependencies as $argument => $dependency) {
                        $argumentData = $dom->createElement($argument);
                        $this->setAttribute($dependency, $argumentData, $classesMetadata);
                        $argumentsData->appendChild($argumentData);
                    }
                    $methodData->appendChild($argumentsData);
                    $methodsData->appendChild($methodData);
                }
            }
            $classData->appendChild($methodsData);

            $propertiesData = $dom->createElement('properties');
            foreach ($classMetadata->propertiesMetadata as $property => $propertyMetadata) {
                if ($propertyMetadata->dependency !== null && $propertyMetadata->dependency !== '') {
                    $propertyData = $dom->createElement($property);
                    $this->setAttribute($propertyMetadata->dependency, $propertyData, $classesMetadata);
                    $propertiesData->appendChild($propertyData);
                }
            }

            $classData->appendChild($propertiesData);
            $root->appendChild($classData);
            $dom->save($path . $alias . '.xml');
        }
    }
944175
public function setRuntimePath($path)
    {
        $this->_runtimePath = $this->getAlias($path);
        $this->setAlias('@runtime', $this->_runtimePath);
    }
8757
protected function classExists(string $class, string $message): void
    {
        if (!class_exists($class)) {
            $this->log($message, Project::MSG_ERR);
            throw new BuildException($message);
        }
    }
82011
public void addClassPath(String classpath)
  {
    char sep = CauchoUtil.getPathSeparatorChar();
    int head = 0;
    int tail = 0;
    while (head < classpath.length()) {
      tail = classpath.indexOf(sep, head);

      String segment = null;
      if (tail < 0) {
        segment = classpath.substring(head);
        head = classpath.length();
      }
      else {
        segment = classpath.substring(head, tail);
        head = tail + 1;
      }

      if (segment.equals(""))
        continue;
      else if (segment.endsWith(".jar") || segment.endsWith(".zip"))
        addMergePath(JarPath.create(VfsOld.lookup(segment)));
      else
        addMergePath(VfsOld.lookup(segment));
    }
  }
145457
public function main()
    {

        // Apparently casting to (string) no longer invokes __toString() automatically.
        if (is_object($this->classpath)) {
            $classpath = $this->classpath->__toString();
        }

        if (empty($classpath)) {
            throw new BuildException("Provided classpath was empty.");
        }

        $curr_parts = Phing::explodeIncludePath();
        $add_parts = Phing::explodeIncludePath($classpath);
        $new_parts = array_diff($add_parts, $curr_parts);

        if ($new_parts) {
            $this->updateIncludePath($new_parts, $curr_parts);
        }
    }
938538
public function addTaskDefinition($name, $class, $classpath = null)
    {
        ComponentHelper::getComponentHelper($this)->addTaskDefinition($name, $class, $classpath);
    }
1348781
protected function useRelationTraitInClass(string $classPath, string $traitPath): void
    {
        try {
            $class = PhpClass::fromFile($classPath);
        } catch (Error $e) {
            throw new DoctrineStaticMetaException(
                'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
        try {
            $trait = PhpTrait::fromFile($traitPath);
        } catch (Error $e) {
            throw new DoctrineStaticMetaException(
                'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
        $class->addTrait($trait);
        $this->codeHelper->generate($class, $classPath);
    }
1350534
protected static function initWrite($buildfilePath)
    {
        // Overwriting protection
        if (file_exists($buildfilePath)) {
            throw new ConfigurationException('Cannot overwrite existing file.');
        }

        $content = '<?xml version="1.0" encoding="UTF-8" ?>' . PHP_EOL;
        $content .= '' . PHP_EOL;
        $content .= '<project name="" description="" default="">' . PHP_EOL;
        $content .= '    ' . PHP_EOL;
        $content .= '    <target name="" description="">' . PHP_EOL;
        $content .= '        ' . PHP_EOL;
        $content .= '    </target>' . PHP_EOL;
        $content .= '    ' . PHP_EOL;
        $content .= '</project>' . PHP_EOL;

        file_put_contents($buildfilePath, $content);
    }
894813
protected function ensureDirExists($path)
    {
        $f = new PhingFile($this->getOutputDirectory(), $path);
        if (!$f->exists()) {
            if (!$f->mkdirs()) {
                throw new BuildException("Error creating directories: " . $f->getPath());
            }
        }
    }
1030479
private void addRelevantProjectDependenciesToClasspath(Set<URL> path) throws MojoExecutionException {
        if (this.includeProjectDependencies) {
            try {
                getLog().debug("Project Dependencies will be included.");

                URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL();
                getLog().debug("Adding to classpath : " + mainClasses);
                path.add(mainClasses);

                Set<Artifact> dependencies = CastUtils.cast(project.getArtifacts());

                // system scope dependencies are not returned by maven 2.0. See
                // MEXEC-17
                dependencies.addAll(getAllNonTestScopedDependencies());

                Iterator<Artifact> iter = dependencies.iterator();
                while (iter.hasNext()) {
                    Artifact classPathElement = iter.next();
                    getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId()
                        + " to classpath");
                    File file = classPathElement.getFile();
                    if (file != null) {
                        path.add(file.toURI().toURL());
                    }
                }

            } catch (MalformedURLException e) {
                throw new MojoExecutionException("Error during setting up classpath", e);
            }
        } else {
            getLog().debug("Project Dependencies will be excluded.");
        }

    }
857212
public function setRuntimePath($path)
    {
        $this->_runtimePath = Zilf::getAlias($path);
        Zilf::setAlias('@runtime', $this->_runtimePath);
    }
852955
public void setClasspath(Path src) {
        if (classpath == null) {
            classpath = src;
        } else {
            classpath.append(src);
        }
    }
1234381
public function main()
    {
        if (isset($this->schema) && !file_exists($this->schema->getPath())) {
            throw new BuildException("Schema file not found: " . $this->schema->getPath());
        }
        if (!isset($this->file) and count($this->filesets) == 0) {
            throw new BuildException("Missing either a nested fileset or attribute 'file' set");
        }

        set_error_handler([$this, 'errorHandler']);
        if ($this->file instanceof PhingFile) {
            $this->lint($this->file->getPath());
        } else { // process filesets
            $project = $this->getProject();
            foreach ($this->filesets as $fs) {
                $ds = $fs->getDirectoryScanner($project);
                $files = $ds->getIncludedFiles();
                $dir = $fs->getDir($this->project)->getPath();
                foreach ($files as $file) {
                    $this->lint($dir . DIRECTORY_SEPARATOR . $file);
                }
            }
        }
        restore_error_handler();
    }
710486
private void setClassPath() throws IOException {
    String fullPath = file.getAbsolutePath();
    String rootPath = fullPath.substring(0, fullPath.lastIndexOf(classFile.getRelativePath()));
    List<File> classPath = new ArrayList<>();
    classPath.add(new File(rootPath));
    parserEnv.fileManager().setLocation(StandardLocation.CLASS_PATH, classPath);
  }
257935
protected function encodeFile($filePath)
    {
        $command = $this->encodeCommand . $filePath . ' 2>&1';

        $this->log('Running: ' . $command, Project::MSG_VERBOSE);

        $tmp = exec($command, $output, $return_var);
        if ($return_var !== 0) {
            throw new BuildException("Encoding failed. \n Msg: " . $tmp . " \n Encode command: " . $command);
        }

        return true;
    }
661271
public function addPath($path, $namespace = self::MAIN_NAMESPACE)
    {
        // invalidate the cache
        $this->cache = $this->errorCache = [];

        if (!is_dir($path)) {
            throw new LoaderException(sprintf('The "%s" directory does not exist.', $path));
        }

        $this->paths[$namespace][] = rtrim($path, '/\\');
    }