src/java/de/uhilger/filecms/api/CompileService.java | ●●●●● patch | view | raw | blame | history | |
web/ui/index.html | ●●●●● patch | view | raw | blame | history | |
web/ui/ui.js | ●●●●● patch | view | raw | blame | history |
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); web/ui/index.html
@@ -120,6 +120,7 @@ <a id="m-test-2" class="dropdown-item" href="#">Compile</a> <a id="m-test-3" class="dropdown-item" href="#">Compile all</a> <a id="m-compile-results" class="dropdown-item" href="#">Compile results</a> <a id="m-build-app" class="dropdown-item" href="#">Build app</a> <div class="dropdown-divider"></div> <a id="logout" class="dropdown-item" href="#">Abmelden</a> </div> web/ui/ui.js
@@ -65,6 +65,7 @@ $('#m-test-2').on('click', fm_menu_compile); $('#m-test-3').on('click', fm_menu_compile_all); $('#m-compile-results').on('click', fm_fusszeile_zeigen); $('#m-build-app').on('click', fm_menu_build_app); $('#saveModal').on('hidden.bs.modal', function (e) { $('#modal_ok').attr('onclick','').unbind('click'); }); @@ -334,6 +335,10 @@ fm_compile_all(); } function fm_menu_build_app() { fm_build_app(); } function fm_mark_compile_results_in_editor(resp) { cm.clearGutter("breakpoints"); @@ -361,6 +366,16 @@ } } function fm_build_app() { var m = '?c=de.uhilger.filecms.api.CompileService&m=buildApp&p=' + pfad; var u = '../svc' + m; fm_get(u, "text", function(resp) { $('.system-out').empty(); $('.system-out').append('Ergebnis von Build app: ' + resp); fm_fusszeile_zeigen(); }); } function fm_compile_all() { var m = '?c=de.uhilger.filecms.api.CompileService&m=compileAll&p=' + pfad; var u = '../svc' + m;