Versuche mit dem Java-Compiler (in Arbeit)
| | |
| | | private ServletContext ctx;
|
| | | private HttpServletRequest request;
|
| | |
|
| | | public List<CompilerIssue> compile(String relPath, List fileNames) throws IOException {
|
| | | /**
|
| | | * |
| | | * @param relPath
|
| | | * @param fileNames
|
| | | * @param mode 0 = test, 1 = build
|
| | | * @return
|
| | | * @throws IOException |
| | | */
|
| | | public List<CompilerIssue> compile(String relPath, List fileNames, String mode) throws IOException {
|
| | | //Files[] files1 = ... ; // input for first compilation task
|
| | | //Files[] files2 = ... ; // input for second compilation task
|
| | |
|
| | |
| | |
|
| | | Iterable<? extends JavaFileObject> compilationUnits1 = fileManager.getJavaFileObjectsFromFiles(files);
|
| | |
|
| | | /*
|
| | | final Iterable<String> options =
|
| | | Arrays.asList(new String[]{"-Xlint",
|
| | | "-cp", project.getClassPath(),
|
| | | |
| | | |
| | | if( mode.equals("1")) {
|
| | | final Iterable<String> options = Arrays.asList(new String[]{"-Xlint",
|
| | | /*"-cp", project.getClassPath(),*/
|
| | | "-d", targetDir.getAbsolutePath()
|
| | | });
|
| | | |
| | | compiler.getTask(null, fileManager, diagnostics, options, null, compilationUnits1).call();
|
| | | */
|
| | | compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits1).call();
|
| | | } else {
|
| | | compiler.getTask(null, null, diagnostics, null, null, compilationUnits1).call();
|
| | | } |
| | | |
| | | //compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits1).call();
|
| | |
|
| | | /*
|
| | | Iterable<? extends JavaFileObject> compilationUnits2
|
| | |
| | | } |
| | | |
| | | function fm_menu_test_2() { |
| | | var liste = fm_gewaehlte_dateien(); |
| | | var m = '?c=de.uhilger.filecms.api.CompileService&m=compile&p=' + pfad + '&p=' + encodeURIComponent(liste); |
| | | var u = '../svc' + m; |
| | | fm_get(u, "json", function(resp) { |
| | | fm_compile('0', fm_mark_compile_results_in_editor); |
| | | } |
| | | |
| | | function fm_mark_compile_results_in_editor(resp) { |
| | | cm.clearGutter("breakpoints"); |
| | | |
| | | if(resp.List[0].CompilerIssue !== undefined) { |
| | |
| | | cm.setGutterMarker(lno-1, "breakpoints", makeMarker(eMsg)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | function fm_compile(modeStr, callback) { |
| | | var liste = fm_gewaehlte_dateien(); |
| | | var m = '?c=de.uhilger.filecms.api.CompileService&m=compile&p=' + pfad + '&p=' + encodeURIComponent(liste) + |
| | | '&p=' + modeStr; |
| | | var u = '../svc' + m; |
| | | fm_get(u, "json", function(resp) { |
| | | callback(resp); |
| | | }); |
| | | } |
| | | |