public Path getTargetClasses() { return FileSystems.getDefault().getPath(settings.targetClasses()); }
public Path getTargetClasses() { return FileSystems.getDefault().getPath(settings.targetClasses()); }
protected String getCommand(AppSettings appSettings, Optional<String> pack, String pathSeparator) { return "java" + " -cp \"" + appSettings.targetClasses() + pathSeparator + appSettings.targetDependency() + "/*\"" + " -Drestx.app.package=" + pack.get() + " -Drestx.mode=prod"; } }
public void unpack(Path destinationDirectory, AppSettings appSettings) { Path targetClassesDir = destinationDirectory.resolve(appSettings.targetClasses()); try ( JarFile jar = new JarFile(jarFile.toFile()) ) { if(jar.getJarEntry(CHROOT+"md.restx.json") == null) {
@Override public void run(RestxShell shell) throws Exception { AppSettings appSettings = shell.getFactory() .getComponent(AppSettings.class); compileMode.compile( shell, Paths.get(appSettings.targetClasses()), Paths.get(appSettings.targetDependency()), Paths.get(appSettings.mainSources()), Paths.get(appSettings.mainResources()), null); } }
@Override public void run(RestxShell shell) throws Exception { AppSettings appSettings = shell.getFactory().getComponent(AppSettings.class); new RestxArchive(jarFile).pack( shell.currentLocation(), shell.currentLocation().resolve(appSettings.targetClasses()), Arrays.asList("target", "tmp", "logs") ); } }
public void run(RestxShell shell) throws IOException, InterruptedException { Path targetClasses = Paths.get(appSettings.targetClasses()); Path dependenciesDir = Paths.get(appSettings.targetDependency()); Path mainSources = Paths.get(appSettings.mainSources()); Path mainResources = Paths.get(appSettings.mainResources()); if (!compile.compile(shell, targetClasses, dependenciesDir, mainSources, mainResources, appClassName)) return; shell.println("starting " + appClassName + "..." + (daemon ? " - type `stop` to stop it and go back to restx shell" : "")); vmOptions.add("-Drestx.app.package=" + appSettings.appPackage()); Process run = Apps.with(appSettings) .run(shell.currentLocation().toFile(), targetClasses, dependenciesDir, vmOptions, appClassName, Collections.<String>emptyList(), quiet); if (daemon) { while (!shell.ask("", "").equals("stop")) { shell.printIn("restx> unrecognized command - type `stop` to stop the app", RestxShell.AnsiCodes.ANSI_YELLOW); shell.println(""); } run.destroy(); } run.waitFor(); }