Do the work

@throws BuildException
197329
public function main()
    {
        $this->verifyConfiguration();
        $this->prepareEncoderCommand();

        try {
            if (empty($this->filesets)) {
                throw new BuildException(
                    "You must supply nested fileset.",
                    $this->getLocation()
                );
            }

            $encodedFilesCounter = 0;

            foreach ($this->filesets as $fs) {
                /* @var $fs FileSet */

                /* @var $fsBasedir PhingFile */
                $fsBasedir = $fs->getDir($this->project)->getAbsolutePath();

                $files = $fs->getIterator(false);

                foreach ($files as $file) {
                    $f = new PhingFile($fsBasedir, $file);

                    if ($f->isFile()) {
                        $path = $f->getAbsolutePath();

                        $this->log("Encoding " . $path, Project::MSG_VERBOSE);
                        $this->encodeFile($path);

                        $encodedFilesCounter++;
                    }
                }
            }

            $this->log("Encoded files: " . $encodedFilesCounter);
        } catch (IOException $ioe) {
            $msg = "Problem encoding files: " . $ioe->getMessage();
            throw new BuildException($msg, $ioe, $this->getLocation());
        }
    }
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.');
    }
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);
        }
    }
1096440
@Override
   public void execute() throws BuildException
   {
      try
      {
         DirectoryScanner dsc = fileset.getDirectoryScanner(getProject());
         File baseDir = dsc.getBasedir();
         String[] files = dsc.getIncludedFiles();
         for (int i = 0; i < files.length; i++)
         {
            String currentFile = files[i];
            File moduleXml = new File(baseDir, currentFile);
            String modulePath = currentFile.substring(0, currentFile.lastIndexOf(File.separator));
            File libDir = new File(targetDir, modulePath);
            File destFile = new File(targetDir, currentFile);
            System.out.println("Processing descriptor for module " + modulePath);
            System.out.println("* Source module descriptor: " + moduleXml);
            System.out.println("* Destination module descriptor: " + destFile);
            String c = readFileContents(moduleXml);
            if (libDir.exists())
            {
               String[] libs = libDir.list(new FilenameFilter()
               {
                  @Override
                  public boolean accept(File dir, String name)
                  {
                     return name.endsWith(".jar") || name.endsWith(".ear") || name.endsWith(".sar")
                           || name.endsWith(".war");
                  }
               });
               BufferedWriter out = new BufferedWriter(new FileWriter(destFile));
               out.write(updateContents(c, libs));
               out.close();
            }
            else
            {
               libDir.mkdirs();
               BufferedWriter out = new BufferedWriter(new FileWriter(destFile));
               out.write(c);
               out.close();
            }
         }
      }
      catch (Exception e)
      {
         e.printStackTrace();
         throw new BuildException(e);
      }
   }
1258862
public void execute() throws BuildException
   {
      try
      {
         if (isLocal())
         {
            if (!isCommandAvailable("local-list"))
               throw new BuildException("Unable to ping " + getHost() + ":" + getPort());
         }
         else
         {
            if (!isCommandAvailable("remote-list"))
               throw new BuildException("Unable to ping " + getHost() + ":" + getPort());
         }
      }
      catch (Throwable t)
      {
         throw new BuildException("Unable to ping " + getHost() + ":" + getPort() + " (" + t.getMessage() + ")", t);
      }
   }
1034834
@Override
  public void execute() throws BuildException {
    validate();

    if (allowUndefined) {
      values.add(null);
    }

    long permutedSeed = SeedUtils.parseSeedChain(random)[0];
    permutedSeed ^= new Random(executionId.incrementAndGet()).nextLong();

    StringValue pick = RandomPicks.randomFrom(new Random(permutedSeed), values);
    if (pick != null) {
      getProject().setProperty(propertyName, pick.toString());
    }
  }
767032
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('log');
        $command
            ->setOption('stat', $this->getStat())
            ->setOption('name-status', $this->isNameStatus())
            ->setOption('no-merges', $this->isNoMerges())
            ->setOption('format', $this->getFormat());

        if (null !== $this->getMaxCount()) {
            $command->setOption('max-count', $this->getMaxCount());
        }

        if (null !== $this->getDate()) {
            $command->setOption('date', $this->getDate());
        }

        if (null !== $this->getSince()) {
            $command->setOption('since', $this->getSince());
        }

        if (null !== $this->getUntil()) {
            $command->setOption('until', $this->getUntil());
        }

        $command->addDoubleDash(true);
        if (null !== $this->getPaths()) {
            $command->addDoubleDash(false);
            $paths = explode(PATH_SEPARATOR, $this->getPaths());
            foreach ($paths as $path) {
                $command->addArgument($path);
            }
        }

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

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

        if (null !== $this->outputProperty) {
            $this->project->setProperty($this->outputProperty, trim($output));
        }

        $this->log(
            sprintf('git-log: commit log for "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
        $this->log('git-log output: ' . trim($output), Project::MSG_INFO);
    }
535461
public function main()
    {
        if ($this->property === '') {
            throw new BuildException('no property specified');
        }
        if ($this->destDir === null) {
            $this->destDir = $this->getProject()->resolveFile('.');
        }
        $fu = new FileUtils;
        $tmpFile = $fu->createTempFile(
            $this->prefix,
            $this->suffix,
            $this->destDir,
            $this->deleteOnExit,
            $this->createFile
        );
        $this->getProject()->setNewProperty($this->property, (string) $tmpFile);
    }
1361829
public function main()
    {
        if (!$this->defaultrequested && $this->add === "" && $this->remove === "" && !$this->echo) {
            throw new BuildException(
                "<defaultexcludes> task must set at least one attribute (echo=\"false\")"
                . " doesn't count since that is the default"
            );
        }
        if ($this->defaultrequested) {
            DirectoryScanner::resetDefaultExcludes();
        }
        if ($this->add !== "") {
            DirectoryScanner::addDefaultExclude($this->add);
        }
        if ($this->remove !== "") {
            DirectoryScanner::removeDefaultExclude($this->remove);
        }
        if ($this->echo) {
            $lineSep = Phing::getProperty('line.separator');
            $message = "Current Default Excludes:";
            $message .= $lineSep;
            $excludes = DirectoryScanner::getDefaultExcludes();
            $message .= "  ";
            $message .= implode($lineSep . "  ", $excludes);
            $this->log($message, $this->logLevel);
        }
    }
1343596
public function main()
    {
        if ($this->file === null && count($this->filesets) === 0) {
            throw new BuildException(
                'import requires file attribute or at least one nested fileset'
            );
        }
        if ($this->getOwningTarget() === null || $this->getOwningTarget()->getName() !== '') {
            throw new BuildException('import only allowed as a top-level task');
        }
        if ($this->getLocation() === null || $this->getLocation()->getFileName() === null) {
            throw new BuildException("Unable to get location of import task");
        }

        // Single file.
        if ($this->file !== null) {
            $file = new PhingFile($this->file);
            if (!$file->isAbsolute()) {
                $file = new PhingFile($this->project->getBasedir(), $this->file);
            }
            if (!$file->exists()) {
                $msg = "Unable to find build file: {$file->getPath()}";
                if ($this->optional) {
                    $this->log($msg . '... skipped');
                    return;
                } else {
                    throw new BuildException($msg);
                }
            }
            $this->importFile($file);
        }

        // Filesets.
        $total_files = 0;
        $total_dirs = 0;
        foreach ($this->filesets as $fs) {
            $ds = $fs->getDirectoryScanner($this->project);
            $fromDir = $fs->getDir($this->project);

            $srcFiles = $ds->getIncludedFiles();
            $srcDirs = $ds->getIncludedDirectories();

            $filecount = count($srcFiles);
            $total_files += $filecount;
            for ($j = 0; $j < $filecount; $j++) {
                $this->importFile(new PhingFile($fromDir, $srcFiles[$j]));
            }

            $dircount = count($srcDirs);
            $total_dirs += $dircount;
            for ($j = 0; $j < $dircount; $j++) {
                $this->importFile(new PhingFile($fromDir, $srcDirs[$j]));
            }
        }
    }
297041
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');
        }

        $client = $this->getGitClient(false, $this->getRepository());
        $command = $client->getCommand('checkout');
        $command
            ->setOption('no-track', $this->isNoTrack())
            ->setOption('q', $this->isQuiet())
            ->setOption('force', $this->isForce())
            ->setOption('b', $this->isCreate())
            ->setOption('B', $this->isForceCreate())
            ->setOption('m', $this->isMerge());
        if ($this->isNoTrack()) {
            $command->setOption('track', $this->isTrack());
        }

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

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

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

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

        $this->log(
            sprintf('git-checkout: checkout "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
        $this->log('git-checkout output: ' . str_replace('\'', '', trim($output)), Project::MSG_INFO);
    }
356933
public function execute(){
        $ext = self::buildComponent($this->getData());
        $report = $ext->check();            
        $this->setResult(self::buildResult($this->getData(), $report, $ext));
    }
768946
public function main()
    {
        if ($this->length !== null && $this->adjust !== null) {
            throw new BuildException(
                'length and adjust are mutually exclusive options'
            );
        }
        if ($this->length === null && $this->adjust === null) {
            $this->length = 0;
        }
        if ($this->file === null) {
            throw new BuildException('No files specified.');
        }

        if ($this->shouldProcess($this->file)) {
            $this->process($this->file);
        }
    }
842188
public function main()
    {
        if ((count($this->sourceFileSets) === 0) && (count($this->sourceFileLists) === 0)) {
            throw new BuildException(
                'At least one <srcfileset> or <srcfilelist>'
                . ' element must be set'
            );
        }
        if ((count($this->targetFileSets) === 0) && (count($this->targetFileLists) === 0)) {
            throw new BuildException(
                'At least one <targetfileset> or'
                . ' <targetfilelist> element must be set'
            );
        }
        $now = (new DateTime())->getTimestamp();
        /*
          We have to munge the time to allow for the filesystem time
          granularity.
        */
        // $now += FILE_UTILS . getFileTimestampGranularity();

        // Grab all the target files specified via filesets:
        $allTargets = [];
        $oldestTargetTime = 0;
        $oldestTarget = null;
        foreach ($this->targetFileSets as $targetFS) {
            if (!$targetFS->getDir($this->getProject())->exists()) {
                // this is the same as if it was empty, no target files found
                continue;
            }
            $targetDS = $targetFS->getDirectoryScanner($this->getProject());
            $targetFiles = $targetDS->getIncludedFiles();

            foreach ($targetFiles as $targetFile) {
                $dest = new PhingFile($targetFS->getDir($this->getProject()), $targetFile);
                $allTargets[] = $dest;

                if ($dest->lastModified() > $now) {
                    $this->log(
                        'Warning: ' . $targetFile . ' modified in the future.',
                        Project::MSG_WARN
                    );
                }
                if ($oldestTarget === null
                    || $dest->lastModified() < $oldestTargetTime
                ) {
                    $oldestTargetTime = $dest->lastModified();
                    $oldestTarget = $dest;
                }
            }
        }
        // Grab all the target files specified via filelists:
        $upToDate = true;
        foreach ($this->targetFileLists as $targetFL) {
            $targetFiles = $targetFL->getFiles($this->getProject());

            foreach ($targetFiles as $targetFile) {
                $dest = new PhingFile($targetFL->getDir($this->getProject()), $targetFile);
                if (!$dest->exists()) {
                    $this->log($targetFile . ' does not exist.', Project::MSG_VERBOSE);
                    $upToDate = false;
                    continue;
                }

                $allTargets[] = $dest;
                if ($dest->lastModified() > $now) {
                    $this->log(
                        'Warning: ' . $targetFile . ' modified in the future.',
                        Project::MSG_WARN
                    );
                }
                if ($oldestTarget === null
                    || $dest->lastModified() < $oldestTargetTime
                ) {
                    $oldestTargetTime = $dest->lastModified();
                    $oldestTarget = $dest;
                }
            }
        }
        if ($oldestTarget !== null) {
            $this->log($oldestTarget . ' is oldest target file', Project::MSG_VERBOSE);
        } else {
            // no target files, then we cannot remove any target files and
            // skip the following tests right away
            $upToDate = false;
        }
        // Check targets vs source files specified via filelists:
        if ($upToDate) {
            foreach ($this->sourceFileLists as $sourceFL) {
                $sourceFiles = $sourceFL->getFiles($this->getProject());

                foreach ($sourceFiles as $sourceFile) {
                    $src = new PhingFile($sourceFL->getDir($this->getProject()), $sourceFile);

                    if ($src->lastModified() > $now) {
                        $this->log(
                            'Warning: ' . $sourceFile
                            . ' modified in the future.',
                            Project::MSG_WARN
                        );
                    }
                    if (!$src->exists()) {
                        $this->log(
                            $sourceFile . ' does not exist.',
                            Project::MSG_VERBOSE
                        );
                        $upToDate = false;
                        break 2;
                    }
                    if ($src->lastModified() > $oldestTargetTime) {
                        $upToDate = false;
                        $this->log(
                            $oldestTarget . ' is out of date with respect to '
                            . $sourceFile,
                            Project::MSG_VERBOSE
                        );
                        break 2;
                    }
                }
            }
        }
        // Check targets vs source files specified via filesets:
        if ($upToDate) {
            foreach ($this->sourceFileSets as $sourceFS) {
                $sourceDS = $sourceFS->getDirectoryScanner($this->getProject());
                $sourceFiles = $sourceDS->getIncludedFiles();

                foreach ($sourceFiles as $sourceFile) {
                    $src = new PhingFile($sourceFS->getDir($this->getProject()), $sourceFile);

                    if ($src->lastModified() > $now) {
                        $this->log(
                            'Warning: ' . $sourceFile
                            . ' modified in the future.',
                            Project::MSG_WARN
                        );
                    }
                    if ($src->lastModified() > $oldestTargetTime) {
                        $upToDate = false;
                        $this->log(
                            $oldestTarget . ' is out of date with respect to '
                            . $sourceFile,
                            Project::MSG_VERBOSE
                        );
                        break 2;
                    }
                }
            }
        }
        if (!$upToDate) {
            $this->log('Deleting all target files. ', Project::MSG_VERBOSE);
            foreach ($allTargets as $fileToRemove) {
                $this->log(
                    'Deleting file ' . $fileToRemove->getAbsolutePath(),
                    Project::MSG_VERBOSE
                );
                $fileToRemove->delete();
            }
        }
    }
659059
public function main()
    {
        if ($this->dir === null) {
            throw new BuildException("You must specify the \"dir\" attribute for PEAR package task.");
        }

        if ($this->package === null) {
            throw new BuildException("You must specify the \"name\" attribute for PEAR package task.");
        }

        $this->pkg = new PEAR_PackageFileManager();

        $this->setOptions();

        $e = $this->pkg->writePackageFile();
        if (@PEAR::isError($e)) {
            throw new BuildException("Unable to write package file.", new Exception($e->getMessage()));
        }
    }
309104
public function main()
    {
        if (!isset($this->analyzerPath)) {
            throw new BuildException("Missing attribute 'analyzerPath'");
        }

        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->analyze($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->analyze($dir . DIRECTORY_SEPARATOR . $file);
                }
            }
        }

        $this->log("Number of findings: " . $this->counter, Project::MSG_INFO);
    }
249427
public function main()
    {
        if ($this->dir == null) {
            throw new BuildException("missing dir");
        }
        if ($this->name == null) {
            throw new BuildException("missing name");
        }
        if ($this->pathRefId == null) {
            throw new BuildException("missing pathrefid");
        }
        if (!$this->dir->isDirectory()) {
            throw new BuildException(
                (string) $this->dir . " is not a directory"
            );
        }
        $path = $this->getProject()->getReference($this->pathRefId);
        if ($path == null) {
            throw new BuildException("Unknown reference " . $this->pathRefId);
        }
        if (!($path instanceof Path)) {
            throw new BuildException($this->pathRefId . " is not a path");
        }
        $sources = $path->listPaths();
        $fileSet = new FileSet();
        $fileSet->setProject($this->getProject());
        $fileSet->setDir($this->dir);
        $fileUtils = new FileUtils();
        $dirNormal = $fileUtils->normalize($this->dir->getAbsolutePath());
        $dirNormal = rtrim($dirNormal, PhingFile::$separator) . PhingFile::$separator;

        $atLeastOne = false;
        for ($i = 0, $resourcesCount = count($sources); $i < $resourcesCount; ++$i) {
            $sourceFile = new PhingFile($sources[$i]);
            if (!$sourceFile->exists()) {
                continue;
            }
            $includePattern = $this->getIncludePattern($dirNormal, $sourceFile);
            if ($includePattern === false && !$this->ignoreNonRelative) {
                throw new BuildException(
                    $sources[$i] . " is not relative to " . $this->dir->getAbsolutePath()
                );
            }
            if ($includePattern === false) {
                continue;
            }
            $fileSet->createInclude()->setName($includePattern);
            $atLeastOne = true;
        }
        if (!$atLeastOne) {
            $fileSet->createInclude()->setName("a:b:c:d//THis si &&& not a file !!! ");
        }
        $this->getProject()->addReference($this->name, $fileSet);
    }