< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java

Print this page

191 
192         // Create the chunks to be compiled.
193         final CompileChunk[] compileChunks = createCompileChunks(pkgSrcs, oldPackageDependents,
194                 numCompiles, sourcesPerCompile);
195 
196         if (Log.isDebugging()) {
197             int cn = 1;
198             for (CompileChunk cc : compileChunks) {
199                 Log.debug("Chunk "+cn+" for "+id+" ---------------");
200                 cn++;
201                 for (URI u : cc.srcs) {
202                     Log.debug(""+u);
203                 }
204             }
205         }
206 
207         long start = System.currentTimeMillis();
208 
209         // Prepare compilation calls
210         List<Callable<CompilationSubResult>> compilationCalls = new ArrayList<>();
211         final Object lock = new Object();
212         for (int i = 0; i < numCompiles; i++) {
213             CompileChunk cc = compileChunks[i];
214             if (cc.srcs.isEmpty()) {
215                 continue;
216             }
217 
218             String chunkId = id + "-" + String.valueOf(i);
219             Log log = Log.get();
220             compilationCalls.add(() -> {
221                 Log.setLogForCurrentThread(log);
222                 CompilationSubResult result = sjavac.compile("n/a",
223                                                              chunkId,
224                                                              args.prepJavacArgs(),
225                                                              Collections.emptyList(),
226                                                              cc.srcs,
227                                                              visibleSources);
228                 synchronized (lock) {
229                     Util.getLines(result.stdout).forEach(Log::info);
230                     Util.getLines(result.stderr).forEach(Log::error);
231                 }

191 
192         // Create the chunks to be compiled.
193         final CompileChunk[] compileChunks = createCompileChunks(pkgSrcs, oldPackageDependents,
194                 numCompiles, sourcesPerCompile);
195 
196         if (Log.isDebugging()) {
197             int cn = 1;
198             for (CompileChunk cc : compileChunks) {
199                 Log.debug("Chunk "+cn+" for "+id+" ---------------");
200                 cn++;
201                 for (URI u : cc.srcs) {
202                     Log.debug(""+u);
203                 }
204             }
205         }
206 
207         long start = System.currentTimeMillis();
208 
209         // Prepare compilation calls
210         List<Callable<CompilationSubResult>> compilationCalls = new ArrayList<>();
211         final Object lock = new Object() {};
212         for (int i = 0; i < numCompiles; i++) {
213             CompileChunk cc = compileChunks[i];
214             if (cc.srcs.isEmpty()) {
215                 continue;
216             }
217 
218             String chunkId = id + "-" + String.valueOf(i);
219             Log log = Log.get();
220             compilationCalls.add(() -> {
221                 Log.setLogForCurrentThread(log);
222                 CompilationSubResult result = sjavac.compile("n/a",
223                                                              chunkId,
224                                                              args.prepJavacArgs(),
225                                                              Collections.emptyList(),
226                                                              cc.srcs,
227                                                              visibleSources);
228                 synchronized (lock) {
229                     Util.getLines(result.stdout).forEach(Log::info);
230                     Util.getLines(result.stderr).forEach(Log::error);
231                 }
< prev index next >