From 6720b65e8c3d886cf91c011e45578f70f0207973 Mon Sep 17 00:00:00 2001 From: ulrich <not disclosed> Date: Sun, 04 Mar 2018 14:05:03 +0000 Subject: [PATCH] Doku ergaenzt --- src/java/de/uhilger/filecms/api/CompileService.java | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/src/java/de/uhilger/filecms/api/CompileService.java b/src/java/de/uhilger/filecms/api/CompileService.java index 2aaf5aa..c12c1c7 100644 --- a/src/java/de/uhilger/filecms/api/CompileService.java +++ b/src/java/de/uhilger/filecms/api/CompileService.java @@ -42,6 +42,38 @@ public class CompileService extends Api { private static final Logger logger = Logger.getLogger(CompileService.class.getName()); + + /** + * Annahme: relPath zeigt auf einen Ordner, in dem ein build-Ordner die + * fertigen Klassen und ein web-Ordner die Struktur mit WEB-INF + * enthaelt. + * + * @param relPath der relative Pfad, der auf den App-Ordner verweist + * @return + */ + public String buildApp(String relPath) { + String result = "ok"; + try { + File targetDir = getTargetDir(relPath); // App-Ordner + File classesDir = new File(targetDir, "web/WEB-INF/classes"); + if(classesDir.exists()) { + FileUtils.deleteDirectory(classesDir); + } + classesDir.mkdirs(); + File buildDir = new File(targetDir, "build/"); + File[] files = buildDir.listFiles(); + for(int i = 0; i < files.length; i++) { + if(files[i].isDirectory()) { + FileUtils.copyDirectoryToDirectory(files[i], classesDir); + } else { + FileUtils.copyFileToDirectory(files[i], classesDir); + } + } + } catch(Exception ex) { + logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex); + } + return result; + } public List<CompilerIssue> compileAll(String relPath) { logger.fine(relPath); @@ -164,7 +196,7 @@ } private final Iterable<String> buildOptions(File targetDir) { - String cbase = getCatalinaBase(); + String cbase = getCatalinaBase(getServletContext()); File lib = new File(cbase, "lib"); String cp = ""; cp = buildCPFromDir(cp, lib); -- Gitblit v1.9.3