Examples of Launch4jPluginExtension


Examples of edu.sc.seis.launch4j.Launch4jPluginExtension

        final File installer = ((Zip) project.getTasks().getByName("packageInstaller")).getArchivePath();

        File output = new File(installer.getParentFile(), installer.getName().replace(".jar", "-win.exe"));
        project.getArtifacts().add("archives", output);

        Launch4jPluginExtension ext = (Launch4jPluginExtension) project.getExtensions().getByName("launch4j");
        ext.setOutfile(output.getAbsolutePath());
        ext.setJar(installer.getAbsolutePath());

        String command = delayedFile(DevConstants.LAUNCH4J_DIR).call().getAbsolutePath();
        command += "/launch4j";

        if (Constants.OPERATING_SYSTEM == OS.WINDOWS)
            command += "c.exe";
        else
        {
            final String extraCommand = command;

            Task task = project.getTasks().getByName("extractL4J");
            task.doLast(new Action<Task>() {

                @Override
                public void execute(Task task)
                {
                    File f = new File(extraCommand);
                    if (!f.canExecute())
                    {
                        boolean worked = f.setExecutable(true);
                        project.getLogger().info("Setting file +X "+worked + " : "+f.getPath());
                    }
                    FileTree tree = delayedFileTree(DevConstants.LAUNCH4J_DIR + "/bin").call();
                    tree.visit(new FileVisitor()
                    {
                        @Override public void visitDir(FileVisitDetails dirDetails){}
                        @Override
                        public void visitFile(FileVisitDetails fileDetails)
                        {
                            if (!fileDetails.getFile().canExecute())
                            {
                                boolean worked = fileDetails.getFile().setExecutable(true);
                                project.getLogger().info("Setting file +X "+worked + " : "+fileDetails.getPath());
                            }
                        }
                    });
                }
            });
        }

        ext.setLaunch4jCmd(command);

        Task task = project.getTasks().getByName("generateXmlConfig");
        task.dependsOn("packageInstaller", "extractL4J");
        task.getInputs().file(installer);

        String icon = ext.getIcon();
        if (icon == null || icon.isEmpty())
        {
            icon = delayedFile(DevConstants.LAUNCH4J_DIR + "/demo/SimpleApp/l4j/SimpleApp.ico").call().getAbsolutePath();
        }
        icon = new File(icon).getAbsolutePath();
        ext.setIcon(icon);
        ext.setMainClassName(delayedString("{MAIN_CLASS}").call());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.