|
13 | 13 | import javax.tools.JavaFileObject;
|
14 | 14 | import javax.tools.StandardJavaFileManager;
|
15 | 15 | import javax.tools.ToolProvider;
|
| 16 | +import org.slf4j.Logger; |
| 17 | +import org.slf4j.LoggerFactory; |
16 | 18 | import jp.kusumotolab.kgenprog.project.GeneratedAST;
|
17 | 19 | import jp.kusumotolab.kgenprog.project.GeneratedSourceCode;
|
18 | 20 | import jp.kusumotolab.kgenprog.project.factory.TargetProject;
|
|
31 | 33 | */
|
32 | 34 | public class ProjectBuilder {
|
33 | 35 |
|
| 36 | + public static final Logger log = LoggerFactory.getLogger(ProjectBuilder.class); |
| 37 | + |
34 | 38 | // TODO デフォルトのコンパイラバージョンは要検討.ひとまず1.8固定.
|
35 | 39 | // TODO #289: 加え,toml からコンパイラバージョンを指定できるようにするべき.
|
36 | 40 | private static final String DEFAULT_JDK_VERSION = "1.8";
|
@@ -79,6 +83,23 @@ public BuildResults build(final GeneratedSourceCode generatedSourceCode) {
|
79 | 83 | final boolean success = build(allAsts, javaSourceObjects, diagnostics, progress);
|
80 | 84 |
|
81 | 85 | if (!success) {
|
| 86 | + if (!diagnostics.getDiagnostics() |
| 87 | + .isEmpty()) { |
| 88 | + final StringBuilder sb = new StringBuilder(); |
| 89 | + sb.append("build failed.") |
| 90 | + .append(System.lineSeparator()) |
| 91 | + .append(diagnostics.getDiagnostics() |
| 92 | + .get(0)); |
| 93 | + if (diagnostics.getDiagnostics() |
| 94 | + .size() > 1) { |
| 95 | + sb.append(System.lineSeparator()) |
| 96 | + .append("and ") |
| 97 | + .append(diagnostics.getDiagnostics() |
| 98 | + .size() - 1) |
| 99 | + .append(" more."); |
| 100 | + } |
| 101 | + log.debug(sb.toString()); |
| 102 | + } |
82 | 103 | return new EmptyBuildResults(diagnostics, progress.toString());
|
83 | 104 | }
|
84 | 105 | }
|
|
0 commit comments