The main entry point.

@return void

@throws BuildException
761962
public function main()
    {
        $this->setup('info');

        if ($this->oldVersion) {
            $output = $this->run(['--xml', '--incremental']);

            if (!($xmlObj = @simplexml_load_string($output))) {
                throw new BuildException("Failed to parse the output of 'svn info --xml'.");
            }

            $object = $xmlObj->{$this->element};

            if (!empty($this->subElement)) {
                $object = $object->{$this->subElement};
            }
        } else {
            $output = $this->run();

            if (empty($output) || !isset($output['entry'][0])) {
                throw new BuildException("Failed to parse the output of 'svn info'.");
            }

            $object = $output['entry'][0][$this->element];

            if (!empty($this->subElement)) {
                $object = $object[$this->subElement];
            }
        }

        $this->project->setProperty($this->getPropertyName(), (string) $object);
    }
265896
public function main()
    {
        if (!class_exists('PHP_CodeSniffer')) {
            @include_once 'PHP/CodeSniffer.php';

            if (!class_exists('PHP_CodeSniffer')) {
                throw new BuildException(
                    "This task requires the PHP_CodeSniffer package installed and available on the include path",
                    $this->getLocation()
                );
            }
        }

        /**
         * Determine PHP_CodeSniffer version number
         */
        if (!$this->skipversioncheck) {
            if (defined('PHP_CodeSniffer::VERSION')) {
                preg_match('/\d\.\d\.\d/', PHP_CodeSniffer::VERSION, $version);
            } else {
                preg_match('/\d\.\d\.\d/', shell_exec('phpcs --version'), $version);
            }

            if (version_compare($version[0], '1.2.2') < 0) {
                throw new BuildException(
                    'PhpCodeSnifferTask requires PHP_CodeSniffer version >= 1.2.2',
                    $this->getLocation()
                );
            }
        }

        if (!isset($this->file) and count($this->filesets) == 0) {
            throw new BuildException("Missing either a nested fileset or attribute 'file' set");
        }

        if (count($this->formatters) == 0) {
            // turn legacy format attribute into formatter
            $fmt = new PhpCodeSnifferTaskFormatterElement();
            $fmt->setType($this->format);
            $fmt->setUseFile(false);
            $this->formatters[] = $fmt;
        }

        $fileList = $this->getFilesToParse();

        $cwd = getcwd();

        // Save command line arguments because it confuses PHPCS (version 1.3.0)
        $oldArgs = $_SERVER['argv'];
        $_SERVER['argv'] = [];
        $_SERVER['argc'] = 0;

        $codeSniffer = new PhpCodeSnifferTaskWrapper($this->verbosity, $this->tabWidth, $this->encoding);
        $codeSniffer->setAllowedFileExtensions($this->allowedFileExtensions);
        if ($this->allowedTypes) {
            PhpCodeSnifferTaskWrapper::$allowedTypes = $this->allowedTypes;
        }
        if (is_array($this->ignorePatterns)) {
            $codeSniffer->setIgnorePatterns($this->ignorePatterns);
        }
        foreach ($this->configData as $configData) {
            $codeSniffer::setConfigData($configData->getName(), $configData->getValue(), true);
        }

        /*
         * Verifying if standard is installed only after setting config data.
         * Custom standard paths could be provided via installed_paths config parameter.
         */
        foreach ($this->standards as $standard) {
            if (PHP_CodeSniffer::isInstalledStandard($standard) === false) {
                // They didn't select a valid coding standard, so help them
                // out by letting them know which standards are installed.
                $installedStandards = PHP_CodeSniffer::getInstalledStandards();
                $numStandards = count($installedStandards);
                $errMsg = '';

                if ($numStandards === 0) {
                    $errMsg = 'No coding standards are installed.';
                } else {
                    $lastStandard = array_pop($installedStandards);

                    if ($numStandards === 1) {
                        $errMsg = 'The only coding standard installed is ' . $lastStandard;
                    } else {
                        $standardList = implode(', ', $installedStandards);
                        $standardList .= ' and ' . $lastStandard;
                        $errMsg = 'The installed coding standards are ' . $standardList;
                    }
                }

                throw new BuildException(
                    'ERROR: the "' . $standard . '" coding standard is not installed. ' . $errMsg,
                    $this->getLocation()
                );
            }
        }

        if (!$this->showWarnings) {
            $codeSniffer->cli->warningSeverity = 0;
        }

        // nasty integration hack
        $values = $codeSniffer->cli->getDefaults();
        $_SERVER['argv'] = ['t'];
        $_SERVER['argc'] = 1;
        foreach ($this->formatters as $fe) {
            if ($fe->getUseFile()) {
                $_SERVER['argv'][] = '--report-' . $fe->getType() . '=' . $fe->getOutfile();
            } else {
                $_SERVER['argv'][] = '--report-' . $fe->getType();
            }

            $_SERVER['argc']++;
        }

        if ($this->cache) {
            ReportsPhingRemoveFromCache::setCache($this->cache);
            // add a fake report to remove from cache
            $_SERVER['argv'][] = '--report-phingRemoveFromCache';
            $_SERVER['argc']++;
        }

        $codeSniffer->process($fileList, $this->standards, $this->sniffs, $this->noSubdirectories);
        $_SERVER['argv'] = [];
        $_SERVER['argc'] = 0;

        if ($this->cache) {
            ReportsPhingRemoveFromCache::setCache(null);
            $this->cache->commit();
        }

        $this->printErrorReport($codeSniffer);

        // generate the documentation
        if ($this->docGenerator !== '' && $this->docFile !== null) {
            ob_start();

            $codeSniffer->generateDocs($this->standards, $this->sniffs, $this->docGenerator);

            $output = ob_get_contents();
            ob_end_clean();

            // write to file
            $outputFile = $this->docFile->getPath();
            $check = file_put_contents($outputFile, $output);

            if ($check === false) {
                throw new BuildException('Error writing doc to ' . $outputFile);
            }
        } elseif ($this->docGenerator !== '' && $this->docFile === null) {
            $codeSniffer->generateDocs($this->standards, $this->sniffs, $this->docGenerator);
        }

        if ($this->haltonerror && $codeSniffer->reporting->totalErrors > 0) {
            throw new BuildException('phpcodesniffer detected ' . $codeSniffer->reporting->totalErrors . ' error' . ($codeSniffer->reporting->totalErrors > 1 ? 's' : ''));
        }

        if ($this->haltonwarning && $codeSniffer->reporting->totalWarnings > 0) {
            throw new BuildException('phpcodesniffer detected ' . $codeSniffer->reporting->totalWarnings . ' warning' . ($codeSniffer->reporting->totalWarnings > 1 ? 's' : ''));
        }

        $_SERVER['argv'] = $oldArgs;
        $_SERVER['argc'] = count($oldArgs);
        chdir($cwd);
    }
933403
public function main()
    {
        if (null === $this->getRepository() && false === $this->getRemoteRepo()) {
            throw new BuildException('"repository" is required parameter');
        }

        if (null === $this->getTreeish()) {
            throw new BuildException('"treeish" is required parameter');
        }

        $cmd = $this->getGitClient(false, $this->getRepository() !== null ? $this->getRepository() : './')
            ->getCommand('archive')
            ->setOption('prefix', $this->prefix)
            ->setOption('output', $this->output !== null ? $this->output->getPath() : false)
            ->setOption('format', $this->format)
            ->setOption('remote', $this->remoteRepo)
            ->addArgument($this->treeish);

        $this->log('Git command : ' . $cmd->createCommandString(), Project::MSG_DEBUG);

        $cmd->execute();

        $msg = 'git-archive: archivating ' . '"' . $this->getRepository() . '" repository (' . $this->getTreeish() . ')';
        $this->log($msg, Project::MSG_INFO);
    }
496368
public function main() {
    $this->validate();

    // Remove existing destination first.
    if ($this->dest->exists()) {
      $this->log("Replacing existing resource '" . $this->dest->getPath() . "'");

      if ($this->dest->delete(TRUE) === FALSE) {
        throw new BuildException("Failed to delete existing destination '$this->dest'");
      }
    }

    // Link or copy the source artifact.
    $this->dest->getParentFile()->mkdirs();
    if ($this->mode == 'copy') {
      $this->log(sprintf("Copying '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
      $this->source->copyTo($this->dest);
    }
    else {
      $this->log(sprintf("Linking '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
      FileSystem::getFileSystem()->symlink($this->source->getPath(), $this->dest->getPath());
    }
  }
1101084
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }
        if (null === $this->getBranchname()) {
            throw new BuildException('"branchname" is required parameter');
        }

        // if we are moving branch, we need to know new name
        if ($this->isMove() || $this->isForceMove()) {
            if (null === $this->getNewBranch()) {
                throw new BuildException('"newbranch" is required parameter');
            }
        }

        $client = $this->getGitClient(false, $this->getRepository());

        $command = $client->getCommand('branch');

        if (version_compare($client->getGitVersion(), '2.15.0', '<')) {
            $command->setOption('set-upstream', $this->isSetUpstream());
        } elseif ($this->isSetUpstreamTo()) {
            $command->setOption('set-upstream-to', $this->getSetUpstreamTo());
        }

        $command
            ->setOption('no-track', $this->isNoTrack())
            ->setOption('force', $this->isForce());
        if ($this->isNoTrack() == false) {
            $command->setOption('track', $this->getTrack());
        }

        // check extra options (delete, move)
        foreach ($this->extraOptions as $option => $flag) {
            if ($flag) {
                $command->setOption($option, true);
            }
        }

        $command->addArgument($this->getBranchname());

        if (null !== $this->getStartPoint()) {
            $command->addArgument($this->getStartPoint());
        }

        if (null !== $this->getNewBranch()) {
            $command->addArgument($this->getNewBranch());
        }

        $this->log('git-branch command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $output = $command->execute();
        } catch (Exception $e) {
            throw new BuildException(
                'Task execution failed with git command "' . $command->createCommandString() . '""',
                $e
            );
        }

        $this->log(
            sprintf('git-branch: branch "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
        $this->log('git-branch output: ' . str_replace('\'', '', trim($output)), Project::MSG_INFO);
    }
1358550
public function main()
    {
        if ('apigen' !== $this->executable && !is_file($this->executable)) {
            throw new BuildException(sprintf('Executable %s not found', $this->executable), $this->getLocation());
        }

        if (!empty($this->options['config'])) {
            // Config check
            if (!is_file($this->options['config'])) {
                throw new BuildException(
                    sprintf(
                        'Config file %s doesn\'t exist',
                        $this->options['config']
                    ),
                    $this->getLocation()
                );
            }
        } else {
            // Source check
            if (empty($this->options['source'])) {
                throw new BuildException('Source is not set', $this->getLocation());
            }
            // Destination check
            if (empty($this->options['destination'])) {
                throw new BuildException('Destination is not set', $this->getLocation());
            }
        }

        // Source check
        if (!empty($this->options['source'])) {
            foreach ($this->options['source'] as $source) {
                if (!file_exists($source)) {
                    throw new BuildException(sprintf('Source %s doesn\'t exist', $source), $this->getLocation());
                }
            }
        }

        // Execute ApiGen
        exec(
            escapeshellcmd($this->executable) . ' ' . escapeshellcmd($this->action) . ' ' . $this->constructArguments(),
            $output,
            $return
        );

        $logType = 0 === $return ? Project::MSG_INFO : Project::MSG_ERR;
        foreach ($output as $line) {
            $this->log($line, $logType);
        }
    }
1271483
public function main()
    {
        $this->checkRequirements();
        $this->getBuildList($this->_buildFile);
        $this->parseTargets();
        $this->buildMarkup();
        $this->buildMarkupFull();
    }
6431
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('pull');
        $command
            ->setOption('rebase', $this->isRebase());

        if (!$this->isRebase()) {
            $command->setOption('no-rebase', $this->isNoRebase());
        }

        $strategy = $this->getStrategy();
        if ($strategy) {
            // check if strategy is valid
            if (false === in_array($strategy, $this->validStrategies)) {
                throw new BuildException(
                    "Could not find merge strategy '" . $strategy . "'\n" .
                    "Available strategies are: " . implode(', ', $this->validStrategies)
                );
            }
            $command->setOption('strategy', $strategy);
            if ($this->getStrategyOption()) {
                $command->setOption(
                    'strategy-option',
                    $this->getStrategyOption()
                );
            }
        }

        // order of arguments is important
        $command
            ->setOption('tags', $this->isTags())
            ->setOption('no-tags', $this->isNoTags())
            ->setOption('keep', $this->isKeepFiles())
            ->setOption('append', $this->isAppend())
            ->setOption('q', $this->isQuiet())
            ->setOption('force', $this->isForce());

        // set operation target
        if ($this->isAllRemotes()) { // --all
            $command->setOption('all', true);
            $this->log('git-pull: fetching from all remotes', Project::MSG_INFO);
        } elseif ($this->getSource()) { // <repository> [<refspec>]
            $command->addArgument($this->getSource());
            if ($this->getRefspec()) {
                $command->addArgument($this->getRefspec());
            }
            $this->log(
                sprintf(
                    'git-pull: pulling from %s %s',
                    $this->getSource(),
                    $this->getRefspec()
                ),
                Project::MSG_INFO
            );
        } else {
            throw new BuildException('No source repository specified');
        }

        $this->log('git-pull command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $output = $command->execute();
        } catch (Exception $e) {
            throw new BuildException('Task execution failed.', $e);
        }

        $this->log('git-pull: complete', Project::MSG_INFO);
        $this->log('git-pull output: ' . trim($output), Project::MSG_INFO);
    }
170398
public function main()
    {
        if ($this->composer === null) {
            $this->findComposer();
        }

        $files = array();
        if (!empty($this->file) && file_exists($this->file)) {
            $files[] = $this->file;
        }

        if (!empty($this->dir)) {
            $found = $this->findFiles();
            foreach ($found as $file) {
                $files[] = $this->dir . DIRECTORY_SEPARATOR . $file;
            }
        }

        foreach ($files as $file) {

            $cmd = $this->composer . ' validate ' . $file;
            $cmd = escapeshellcmd($cmd);

            if ($this->passthru) {
                $retval = null;
                passthru($cmd, $retval);
                if ($retval == 1) {
                    throw new BuildException('invalid composer.json');
                }
            } else {
                $out = array();
                $retval = null;
                exec($cmd, $out, $retval);
                if ($retval == 1) {
                    $err = join("\n", $out);
                    throw new BuildException($err);
                } else {
                    $this->log($out[0]);
                }
            }

        }

    }
94743
public function main()
    {
        $savedMillis = $this->millis;

        if ($this->file === null && count($this->filesets) === 0 && count($this->filelists) === 0) {
            throw new BuildException("Specify at least one source - a file, a fileset or a filelist.");
        }

        if ($this->file !== null && $this->file->exists() && $this->file->isDirectory()) {
            throw new BuildException("Use a fileset to touch directories.");
        }

        try { // try to touch file
            if ($this->dateTime !== null) {
                $this->setMillis(strtotime($this->dateTime));
                if ($this->millis < 0) {
                    throw new BuildException("Date of {$this->dateTime} results in negative milliseconds value relative to epoch (January 1, 1970, 00:00:00 GMT).");
                }
            }
            $this->_touch();
        } catch (Exception $ex) {
            throw new BuildException("Error touch()ing file", $ex, $this->getLocation());
        }

        $this->millis = $savedMillis;
    }
1209638
public function main()
    {
        $this->setup('info');

        if ($this->oldVersion) {
            $output = $this->run(['--xml']);

            if (!($xmlObj = @simplexml_load_string($output))) {
                throw new BuildException("Failed to parse the output of 'svn info --xml'.");
            }

            if ($this->lastChanged) {
                $found = (int) $xmlObj->entry->commit['revision'];
            } else {
                $found = (int) $xmlObj->entry['revision'];
            }
        } else {
            $output = $this->run();

            if (empty($output) || !isset($output['entry'][0])) {
                throw new BuildException("Failed to parse the output of 'svn info'.");
            }

            if ($this->lastChanged) {
                $found = $output['entry'][0]['commit']['revision'];
            } else {
                $found = $output['entry'][0]['revision'];
            }
        }

        $this->project->setProperty($this->getPropertyName(), $found);
    }
434482
public function main()
    {
        if (!isset($this->file) and count($this->filesets) == 0) {
            throw new BuildException("Missing either a nested fileset or attribute 'file' set");
        }

        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);
                }
            }
        }

        // write list of 'bad files' to file (if specified)
        if ($this->tofile) {
            $writer = new FileWriter($this->tofile);

            foreach ($this->badFiles as $file => $messages) {
                foreach ($messages as $msg) {
                    $writer->write($file . "=" . $msg . PHP_EOL);
                }
            }

            $writer->close();
        }

        $message = '';
        foreach ($this->badFiles as $file => $messages) {
            foreach ($messages as $msg) {
                $message .= $file . "=" . $msg . PHP_EOL;
            }
        }

        // save list of 'bad files' with errors to property errorproperty (if specified)
        if ($this->errorProperty) {
            $this->project->setProperty($this->errorProperty, $message);
        }

        if (!empty($this->cache)) {
            $this->cache->commit();
        }

        if ($this->haltOnFailure && $this->hasErrors) {
            throw new BuildException('Syntax error(s) in PHP files: ' . $message);
        }
    }
395214
public function main()
    {
        if ($this->file === null && $this->dir === null && count($this->dirsets) === 0
            && count($this->filesets) === 0 && count($this->filelists) === 0
        ) {
            throw new BuildException(
                "At least one of the file or dir attributes, or a fileset, filelist or dirset element must be set."
            );
        }

        if ($this->quiet && $this->failonerror) {
            throw new BuildException("quiet and failonerror cannot both be set to true", $this->getLocation());
        }

        // delete a single file
        if ($this->file !== null) {
            if ($this->file->exists()) {
                if ($this->file->isDirectory()) {
                    $this->log(
                        "Directory " . $this->file->__toString() . " cannot be removed using the file attribute. Use dir instead."
                    );
                } else {
                    $this->log("Deleting: " . $this->file->__toString());
                    try {
                        $this->file->delete();
                    } catch (Exception $e) {
                        $message = "Unable to delete file " . $this->file->__toString() . ": " . $e->getMessage();
                        if ($this->failonerror) {
                            throw new BuildException($message);
                        } else {
                            $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
                        }
                    }
                }
            } else {
                $message = "Could not find file " . $this->file->getAbsolutePath() . " to delete.";

                if ($this->failonerror) {
                    throw new BuildException($message);
                } else {
                    $this->log($message, ($this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN));
                }
            }
        }

        if ($this->dir !== null) {
            $this->dirsets[] = $this->dir;
        }
        foreach ($this->dirsets as $dirset) {
            if (!$dirset instanceof PhingFile) {
                $ds = $dirset->getDirectoryScanner($this->getProject());
                $dirs = $ds->getIncludedDirectories();
                $baseDir = $ds->getBasedir();
            } else {
                $dirs[0] = $dirset;
            }
            foreach ($dirs as $dir) {
                if (!$dir instanceof PhingFile) {
                    $dir = new PhingFile($baseDir, $dir);
                }
                if ($dir->exists() && $dir->isDirectory()) {
                    if ($this->verbosity === Project::MSG_VERBOSE) {
                        $this->log("Deleting directory " . $dir->__toString());
                    }
                    $this->removeDir($dir);
                } else {
                    $message = "Directory " . $dir->getAbsolutePath() . " does not exist or is not a directory.";

                    if ($this->failonerror) {
                        throw new BuildException($message);
                    } else {
                        $this->log($message, ($this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN));
                    }
                }
            }
        }

        // delete the files in the filelists
        foreach ($this->filelists as $fl) {
            try {
                $files = $fl->getFiles($this->project);
                $this->removeFiles($fl->getDir($this->project), $files, $empty = []);
            } catch (BuildException $be) {
                // directory doesn't exist or is not readable
                if ($this->failonerror) {
                    throw $be;
                } else {
                    $this->log($be->getMessage(), $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
                }
            }
        }

        // delete the files in the filesets
        foreach ($this->filesets as $fs) {
            try {
                $ds = $fs->getDirectoryScanner($this->project);
                $files = $ds->getIncludedFiles();
                $dirs = $ds->getIncludedDirectories();
                $this->removeFiles($fs->getDir($this->project), $files, $dirs);
            } catch (BuildException $be) {
                // directory doesn't exist or is not readable
                if ($this->failonerror) {
                    throw $be;
                } else {
                    $this->log($be->getMessage(), $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
                }
            }
        }
    }
915316
public function main()
    {
        $failCount = 0;
        $taskNo = 0;
        if (count($this->taskList) === 0) {
            throw new BuildException('No tasks specified for <relentless>.');
        }
        $this->log('Relentlessly executing: ' . $this->getDescription());
        foreach ($this->taskList as $t) {
            $taskNo++;
            $desc = $t->getDescription();
            if ($desc === null) {
                $desc = 'task ' . $taskNo;
            }
            if (!$this->terse) {
                $this->log('Executing: ' . $desc);
            }
            try {
                $t->perform();
            } catch (BuildException $x) {
                $this->log('Task ' . $desc . ' failed: ' . $x->getMessage());
                $failCount++;
            }
        }
        if ($failCount > 0) {
            throw new BuildException(
                'Relentless execution: ' . $failCount . ' of ' . count($this->taskList) . ' tasks failed.'
            );
        }

        $this->log('All tasks completed successfully.');
    }
848511
public function main()
    {
        if ($this->tarFile === null) {
            throw new BuildException("tarfile attribute must be set!", $this->getLocation());
        }

        if ($this->tarFile->exists() && $this->tarFile->isDirectory()) {
            throw new BuildException("tarfile is a directory!", $this->getLocation());
        }

        if ($this->tarFile->exists() && !$this->tarFile->canWrite()) {
            throw new BuildException("Can not write to the specified tarfile!", $this->getLocation());
        }

        // shouldn't need to clone, since the entries in filesets
        // themselves won't be modified -- only elements will be added
        $savedFileSets = $this->filesets;

        try {
            if ($this->baseDir !== null) {
                if (!$this->baseDir->exists()) {
                    throw new BuildException(
                        "basedir '" . (string) $this->baseDir . "' does not exist!",
                        $this->getLocation()
                    );
                }
                if (empty($this->filesets)) { // if there weren't any explicit filesets specivied, then
                    // create a default, all-inclusive fileset using the specified basedir.
                    $mainFileSet = new TarFileSet($this->fileset);
                    $mainFileSet->setDir($this->baseDir);
                    $mainFileSet->setProject($this->project);
                    $this->filesets[] = $mainFileSet;
                }
            }

            if (empty($this->filesets)) {
                throw new BuildException(
                    "You must supply either a basedir "
                    . "attribute or some nested filesets.",
                    $this->getLocation()
                );
            }

            // check if tar is out of date with respect to each fileset
            if ($this->tarFile->exists() && $this->isArchiveUpToDate()) {
                $this->log("Nothing to do: " . $this->tarFile->__toString() . " is up to date.", Project::MSG_INFO);
                return;
            }

            $this->log("Building tar: " . $this->tarFile->__toString(), Project::MSG_INFO);

            $tar = new Archive_Tar($this->tarFile->getAbsolutePath(), $this->compression);
            $pear = new PEAR();

            if ($pear::isError($tar->error_object)) {
                throw new BuildException($tar->error_object->getMessage());
            }

            foreach ($this->filesets as $fs) {
                $files = $fs->getIterator($this->includeEmpty);
                if (count($files) > 1 && strlen($fs->getFullpath()) > 0) {
                    throw new BuildException(
                        "fullpath attribute may only "
                        . "be specified for "
                        . "filesets that specify a "
                        . "single file."
                    );
                }
                $fsBasedir = $fs->getDir($this->project);
                $filesToTar = [];
                for ($i = 0, $fcount = count($files); $i < $fcount; $i++) {
                    $f = new PhingFile($fsBasedir, $files[$i]);
                    $filesToTar[] = $f->getAbsolutePath();
                    $this->log("Adding file " . $f->getPath() . " to archive.", Project::MSG_VERBOSE);
                }
                $tar->addModify($filesToTar, $this->prefix, $fsBasedir->getAbsolutePath());

                if ($pear::isError($tar->error_object)) {
                    throw new BuildException($tar->error_object->getMessage());
                }
            }
        } catch (IOException $ioe) {
            $msg = "Problem creating TAR: " . $ioe->getMessage();
            $this->filesets = $savedFileSets;
            throw new BuildException($msg, $ioe, $this->getLocation());
        }

        $this->filesets = $savedFileSets;
    }
164955
public function main()
    {
        if ($this->useSass) {
            if (strlen($this->executable) < 0) {
                throw new BuildException("'executable' must be defined.");
            }
        }

        if (empty($this->filesets) && $this->file === null) {
            throw new BuildException(
                "Missing either a nested fileset or attribute 'file'"
            );
        }

        try {
            $compiler = (new SassTaskCompilerFactory(FileSystem::getFileSystem()))->prepareCompiler($this);
        } catch (BuildException $exception) {
            if ($this->failonerror) {
                throw $exception;
            }
            $this->log($exception->getMessage());
            return;
        }

        if (count($this->filesets) > 0) {
            $this->processFilesets($compiler);
        } elseif ($this->file !== null) {
            $this->processFile($compiler);
        }
    }
20813
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('fetch');
        $command
            ->setOption('tags', $this->isTags())
            ->setOption('no-tags', $this->isNoTags())
            ->setOption('prune', $this->isPrune())
            ->setOption('keep', $this->isKeepFiles())
            ->setOption('q', $this->isQuiet())
            ->setOption('force', $this->isForce());

        // set operation target
        if ($this->isAllRemotes()) { // --all
            $command->setOption('all', true);
        } elseif ($this->getGroup()) { // <group>
            $command->addArgument($this->getGroup());
        } elseif ($this->getSource()) { // <repository> [<refspec>]
            $command->addArgument($this->getSource());
            if ($this->getRefspec()) {
                $command->addArgument($this->getRefspec());
            }
        } else {
            throw new BuildException('No remote repository specified');
        }

        $this->log('git-fetch command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $output = $command->execute();
        } catch (Exception $e) {
            throw new BuildException('Task execution failed.', $e);
        }

        $this->log(
            sprintf('git-fetch: branch "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
        $this->log('git-fetch output: ' . trim($output), Project::MSG_INFO);
    }