Search in sources :

Example 6 with ConfigPersisterException

use of net.sf.launch4j.config.ConfigPersisterException in project cogtool by cogtool.

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)

Example 7 with ConfigPersisterException

use of net.sf.launch4j.config.ConfigPersisterException in project SIMRacingApps by SIMRacingApps.

the class MainFrame method save.

private boolean save() {
    try {
        _configForm.get(ConfigPersister.getInstance().getConfig());
        if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
            File f = _fileChooser.getSelectedFile();
            if (!f.getPath().endsWith(".xml")) {
                f = new File(f.getPath() + ".xml");
            }
            ConfigPersister.getInstance().save(f);
            _saved = true;
            showConfigName(f);
            return true;
        }
        return false;
    } catch (InvariantViolationException ex) {
        warn(ex);
        return false;
    } catch (BindingException ex) {
        warn(ex.getMessage());
        return false;
    } catch (ConfigPersisterException ex) {
        warn(ex.getMessage());
        return false;
    }
}
Also used : InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) File(java.io.File) BindingException(net.sf.launch4j.binding.BindingException)

Example 8 with ConfigPersisterException

use of net.sf.launch4j.config.ConfigPersisterException in project chipKIT32-MAX by chipKIT32.

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

ConfigPersisterException (net.sf.launch4j.config.ConfigPersisterException)8 File (java.io.File)4 Builder (net.sf.launch4j.Builder)4 BuilderException (net.sf.launch4j.BuilderException)4 BindingException (net.sf.launch4j.binding.BindingException)4 InvariantViolationException (net.sf.launch4j.binding.InvariantViolationException)4 Config (net.sf.launch4j.config.Config)4 BuildException (org.apache.tools.ant.BuildException)4