Search in sources :

Example 41 with BuildException

use of org.apache.tools.ant.BuildException in project processdash by dtuma.

the class MergeJars method execute.

public void execute() throws BuildException {
    validate();
    try {
        log("Building jar: " + outputFile);
        run();
    } catch (Exception e) {
        throw new BuildException(e);
    }
}
Also used : BuildException(org.apache.tools.ant.BuildException) IOException(java.io.IOException) BuildException(org.apache.tools.ant.BuildException)

Example 42 with BuildException

use of org.apache.tools.ant.BuildException in project processdash by dtuma.

the class JLexBatch method execute.

public void execute() throws BuildException {
    DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
    String[] srcFilenames = ds.getIncludedFiles();
    if (srcFilenames.length == 0)
        throw new BuildException("You must designate at least one input lexer file.");
    for (int j = 0; j < srcFilenames.length; j++) {
        String inputFilename = srcFilenames[j];
        File inputFile = new File(ds.getBasedir(), inputFilename);
        String outputFilename = getOutputFilename(inputFilename);
        File outputFile = new File(ds.getBasedir(), outputFilename);
        if (outputFile.lastModified() > inputFile.lastModified())
            // file is already up-to-date
            continue;
        try {
            JLex.Main.main(new String[] { inputFile.getAbsolutePath(), outputFile.getAbsolutePath() });
        } catch (IOException ioe) {
            throw new BuildException("Cannot create file '" + outputFile + "'");
        }
    }
}
Also used : DirectoryScanner(org.apache.tools.ant.DirectoryScanner) BuildException(org.apache.tools.ant.BuildException) IOException(java.io.IOException) File(java.io.File)

Example 43 with BuildException

use of org.apache.tools.ant.BuildException in project processdash by dtuma.

the class OrphanedResources method execute.

public void execute() throws BuildException {
    DirectoryScanner ds = getDirectoryScanner(dir);
    String[] srcFiles = ds.getIncludedFiles();
    HashMap props = new HashMap();
    for (int j = 0; j < srcFiles.length; j++) {
        String key = getFileKey(srcFiles[j]);
        if (key != null)
            props.put(key, loadProps(srcFiles[j]));
    }
    numOrphans = 0;
    Iterator i = props.keySet().iterator();
    while (i.hasNext()) {
        String key = (String) i.next();
        checkForOrphans(key, props);
    }
    if (numOrphans > 0)
        throw new BuildException(numOrphans + " orphaned resources found.");
}
Also used : HashMap(java.util.HashMap) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) Iterator(java.util.Iterator) BuildException(org.apache.tools.ant.BuildException)

Example 44 with BuildException

use of org.apache.tools.ant.BuildException in project processdash by dtuma.

the class UpdateIzPackResourceFile method execute.

public void execute() {
    validate();
    if (noUpdatesNeeded())
        return;
    ResourceBundle bundle;
    try {
        bundle = readResourceBundle();
    } catch (Exception e) {
        throw new BuildException("Can't load resource bundle.", e);
    }
    try {
        updateLangpack(bundle);
    } catch (Exception e) {
        throw new BuildException("Couldn't update langpack.", e);
    }
}
Also used : ResourceBundle(java.util.ResourceBundle) BuildException(org.apache.tools.ant.BuildException) IOException(java.io.IOException) BuildException(org.apache.tools.ant.BuildException)

Example 45 with BuildException

use of org.apache.tools.ant.BuildException in project megameklab by MegaMek.

the class Launch4jTask method execute.

public void execute() throws BuildException {
    try {
        if (tmpdir != null) {
            System.setProperty("launch4j.tmpdir", tmpdir.getPath());
        }
        if (bindir != null) {
            System.setProperty("launch4j.bindir", bindir.getPath());
        }
        if (_configFile != null && _config != null) {
            throw new BuildException(Messages.getString("Launch4jTask.specify.config"));
        } else if (_configFile != null) {
            ConfigPersister.getInstance().load(_configFile);
            Config c = ConfigPersister.getInstance().getConfig();
            if (jar != null) {
                c.setJar(jar);
            }
            if (outfile != null) {
                c.setOutfile(outfile);
            }
            if (fileVersion != null) {
                c.getVersionInfo().setFileVersion(fileVersion);
            }
            if (txtFileVersion != null) {
                c.getVersionInfo().setTxtFileVersion(txtFileVersion);
            }
            if (productVersion != null) {
                c.getVersionInfo().setProductVersion(productVersion);
            }
            if (txtProductVersion != null) {
                c.getVersionInfo().setTxtProductVersion(txtProductVersion);
            }
        } else if (_config != null) {
            _config.unwrap();
            ConfigPersister.getInstance().setAntConfig(_config, getProject().getBaseDir());
        } else {
            throw new BuildException(Messages.getString("Launch4jTask.specify.config"));
        }
        final Builder b = new Builder(Log.getAntLog());
        b.build();
    } catch (ConfigPersisterException e) {
        throw new BuildException(e);
    } catch (BuilderException e) {
        throw new BuildException(e);
    }
}
Also used : BuilderException(net.sf.launch4j.BuilderException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) Config(net.sf.launch4j.config.Config) Builder(net.sf.launch4j.Builder) BuildException(org.apache.tools.ant.BuildException)

Aggregations

BuildException (org.apache.tools.ant.BuildException)930 IOException (java.io.IOException)390 File (java.io.File)365 DirectoryScanner (org.apache.tools.ant.DirectoryScanner)75 ArrayList (java.util.ArrayList)65 InputStream (java.io.InputStream)62 Project (org.apache.tools.ant.Project)61 Resource (org.apache.tools.ant.types.Resource)58 FileSet (org.apache.tools.ant.types.FileSet)52 Path (org.apache.tools.ant.types.Path)52 Commandline (org.apache.tools.ant.types.Commandline)51 Properties (java.util.Properties)50 OutputStream (java.io.OutputStream)44 FileOutputStream (java.io.FileOutputStream)42 FileResource (org.apache.tools.ant.types.resources.FileResource)42 FileInputStream (java.io.FileInputStream)41 URL (java.net.URL)40 BufferedReader (java.io.BufferedReader)37 Writer (java.io.Writer)37 MalformedURLException (java.net.MalformedURLException)37