author | alundblad |
Tue, 25 Aug 2015 15:14:41 +0200 | |
changeset 32335 | 7df616378cf3 |
parent 31115 | 8d8e98052d5d |
child 32542 | f4e4f4c4f9f4 |
permissions | -rw-r--r-- |
25605
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
1 |
/* |
31115
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
25605
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
4 |
* |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
10 |
* |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
15 |
* accompanied this code). |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
16 |
* |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
20 |
* |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
23 |
* questions. |
c2d72342fe19
8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents:
25299
diff
changeset
|
24 |
*/ |
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
25 |
package com.sun.tools.sjavac.comp; |
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
26 |
|
32335 | 27 |
import static com.sun.tools.sjavac.server.CompilationResult.ERROR_FATAL; |
28 |
import static java.nio.charset.StandardCharsets.UTF_8; |
|
29 |
||
30 |
import java.io.ByteArrayOutputStream; |
|
27388
d694da45bd7a
8062676: Tests which leak lots of file managers should be fixed (group 2)
jjg
parents:
26992
diff
changeset
|
31 |
import java.io.IOException; |
32335 | 32 |
import java.io.PrintStream; |
33 |
import java.nio.file.Files; |
|
34 |
import java.nio.file.Path; |
|
35 |
import java.util.ArrayList; |
|
36 |
import java.util.Collections; |
|
37 |
import java.util.HashMap; |
|
38 |
import java.util.HashSet; |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
39 |
import java.util.List; |
32335 | 40 |
import java.util.Map; |
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
41 |
import java.util.Set; |
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
42 |
|
32335 | 43 |
import com.sun.tools.sjavac.JavacState; |
31115
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
44 |
import com.sun.tools.sjavac.Log; |
32335 | 45 |
import com.sun.tools.sjavac.Module; |
46 |
import com.sun.tools.sjavac.ProblemException; |
|
47 |
import com.sun.tools.sjavac.Source; |
|
48 |
import com.sun.tools.sjavac.Transformer; |
|
26991
88d998b3bb4b
8056258: Analysis of public API does not take super classes into account
alundblad
parents:
26107
diff
changeset
|
49 |
import com.sun.tools.sjavac.Util; |
32335 | 50 |
import com.sun.tools.sjavac.options.Options; |
51 |
import com.sun.tools.sjavac.options.SourceLocation; |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
52 |
import com.sun.tools.sjavac.server.CompilationResult; |
26098
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
53 |
import com.sun.tools.sjavac.server.Sjavac; |
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
54 |
|
26098
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
55 |
/** |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
56 |
* The sjavac implementation that interacts with javac and performs the actual |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
57 |
* compilation. |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
58 |
* |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
59 |
* <p><b>This is NOT part of any supported API. |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
60 |
* If you write code that depends on this, you do so at your own risk. |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
61 |
* This code and its internal interfaces are subject to change or |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
62 |
* deletion without notice.</b> |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
63 |
*/ |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
64 |
public class SjavacImpl implements Sjavac { |
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
65 |
|
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
66 |
@Override |
32335 | 67 |
public CompilationResult compile(String[] args) { |
68 |
||
69 |
ByteArrayOutputStream outBaos = new ByteArrayOutputStream(); |
|
70 |
ByteArrayOutputStream errBaos = new ByteArrayOutputStream(); |
|
71 |
PrintStream out = new PrintStream(outBaos); |
|
72 |
PrintStream err = new PrintStream(errBaos); |
|
73 |
||
74 |
Options options; |
|
75 |
try { |
|
76 |
options = Options.parseArgs(args); |
|
77 |
} catch (IllegalArgumentException e) { |
|
78 |
Log.error(e.getMessage()); |
|
79 |
return new CompilationResult(ERROR_FATAL); |
|
80 |
} |
|
81 |
||
82 |
Log.setLogLevel(options.getLogLevel()); |
|
83 |
||
84 |
if (!validateOptions(options)) |
|
85 |
return new CompilationResult(ERROR_FATAL); |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
86 |
|
32335 | 87 |
if (!createIfMissing(options.getDestDir())) |
88 |
return new CompilationResult(ERROR_FATAL); |
|
89 |
||
90 |
if (!createIfMissing(options.getStateDir())) |
|
91 |
return new CompilationResult(ERROR_FATAL); |
|
92 |
||
93 |
Path gensrc = options.getGenSrcDir(); |
|
94 |
if (gensrc != null && !createIfMissing(gensrc)) |
|
95 |
return new CompilationResult(ERROR_FATAL); |
|
31115
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
96 |
|
32335 | 97 |
Path hdrdir = options.getHeaderDir(); |
98 |
if (hdrdir != null && !createIfMissing(hdrdir)) |
|
99 |
return new CompilationResult(ERROR_FATAL); |
|
100 |
||
101 |
// Load the prev build state database. |
|
102 |
JavacState javac_state = JavacState.load(options, out, err); |
|
103 |
||
104 |
// Setup the suffix rules from the command line. |
|
105 |
Map<String, Transformer> suffixRules = new HashMap<>(); |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
106 |
|
32335 | 107 |
// Handling of .java-compilation |
108 |
suffixRules.putAll(javac_state.getJavaSuffixRule()); |
|
109 |
||
110 |
// Handling of -copy and -tr |
|
111 |
suffixRules.putAll(options.getTranslationRules()); |
|
31115
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
112 |
|
32335 | 113 |
// All found modules are put here. |
114 |
Map<String,Module> modules = new HashMap<>(); |
|
115 |
// We start out in the legacy empty no-name module. |
|
116 |
// As soon as we stumble on a module-info.java file we change to that module. |
|
117 |
Module current_module = new Module("", ""); |
|
118 |
modules.put("", current_module); |
|
119 |
||
120 |
// Find all sources, use the suffix rules to know which files are sources. |
|
121 |
Map<String,Source> sources = new HashMap<>(); |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
122 |
|
32335 | 123 |
// Find the files, this will automatically populate the found modules |
124 |
// with found packages where the sources are found! |
|
125 |
findSourceFiles(options.getSources(), |
|
126 |
suffixRules.keySet(), |
|
127 |
sources, |
|
128 |
modules, |
|
129 |
current_module, |
|
130 |
options.isDefaultPackagePermitted(), |
|
131 |
false); |
|
26991
88d998b3bb4b
8056258: Analysis of public API does not take super classes into account
alundblad
parents:
26107
diff
changeset
|
132 |
|
32335 | 133 |
if (sources.isEmpty()) { |
134 |
Log.error("Found nothing to compile!"); |
|
135 |
return new CompilationResult(CompilationResult.ERROR_FATAL, |
|
136 |
new String(outBaos.toByteArray(), UTF_8), |
|
137 |
new String(errBaos.toByteArray(), UTF_8)); |
|
138 |
} |
|
139 |
||
140 |
||
141 |
// Create a map of all source files that are available for linking. Both -src and |
|
142 |
// -sourcepath point to such files. It is possible to specify multiple |
|
143 |
// -sourcepath options to enable different filtering rules. If the |
|
144 |
// filters are the same for multiple sourcepaths, they may be concatenated |
|
145 |
// using :(;). Before sending the list of sourcepaths to javac, they are |
|
146 |
// all concatenated. The list created here is used by the SmartFileWrapper to |
|
147 |
// make sure only the correct sources are actually available. |
|
148 |
// We might find more modules here as well. |
|
149 |
Map<String,Source> sources_to_link_to = new HashMap<>(); |
|
31115
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
150 |
|
32335 | 151 |
List<SourceLocation> sourceResolutionLocations = new ArrayList<>(); |
152 |
sourceResolutionLocations.addAll(options.getSources()); |
|
153 |
sourceResolutionLocations.addAll(options.getSourceSearchPaths()); |
|
154 |
findSourceFiles(sourceResolutionLocations, |
|
155 |
Collections.singleton(".java"), |
|
156 |
sources_to_link_to, |
|
157 |
modules, |
|
158 |
current_module, |
|
159 |
options.isDefaultPackagePermitted(), |
|
160 |
true); |
|
161 |
||
162 |
// Add the set of sources to the build database. |
|
163 |
javac_state.now().flattenPackagesSourcesAndArtifacts(modules); |
|
164 |
javac_state.now().checkInternalState("checking sources", false, sources); |
|
165 |
javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to); |
|
166 |
javac_state.setVisibleSources(sources_to_link_to); |
|
167 |
||
168 |
int round = 0; |
|
169 |
printRound(round); |
|
170 |
||
171 |
// If there is any change in the source files, taint packages |
|
172 |
// and mark the database in need of saving. |
|
173 |
javac_state.checkSourceStatus(false); |
|
174 |
||
175 |
// Find all existing artifacts. Their timestamp will match the last modified timestamps stored |
|
176 |
// in javac_state, simply because loading of the JavacState will clean out all artifacts |
|
177 |
// that do not match the javac_state database. |
|
178 |
javac_state.findAllArtifacts(); |
|
179 |
||
180 |
// Remove unidentified artifacts from the bin, gensrc and header dirs. |
|
181 |
// (Unless we allow them to be there.) |
|
182 |
// I.e. artifacts that are not known according to the build database (javac_state). |
|
183 |
// For examples, files that have been manually copied into these dirs. |
|
184 |
// Artifacts with bad timestamps (ie the on disk timestamp does not match the timestamp |
|
185 |
// in javac_state) have already been removed when the javac_state was loaded. |
|
186 |
if (!options.areUnidentifiedArtifactsPermitted()) { |
|
187 |
javac_state.removeUnidentifiedArtifacts(); |
|
188 |
} |
|
189 |
// Go through all sources and taint all packages that miss artifacts. |
|
190 |
javac_state.taintPackagesThatMissArtifacts(); |
|
191 |
||
192 |
// Check recorded classpath public apis. Taint packages that depend on |
|
193 |
// classpath classes whose public apis have changed. |
|
194 |
javac_state.taintPackagesDependingOnChangedClasspathPackages(); |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
195 |
|
32335 | 196 |
// Now clean out all known artifacts belonging to tainted packages. |
197 |
javac_state.deleteClassArtifactsInTaintedPackages(); |
|
198 |
// Copy files, for example property files, images files, xml files etc etc. |
|
199 |
javac_state.performCopying(Util.pathToFile(options.getDestDir()), suffixRules); |
|
200 |
// Translate files, for example compile properties or compile idls. |
|
201 |
javac_state.performTranslation(Util.pathToFile(gensrc), suffixRules); |
|
202 |
// Add any potentially generated java sources to the tobe compiled list. |
|
203 |
// (Generated sources must always have a package.) |
|
204 |
Map<String,Source> generated_sources = new HashMap<>(); |
|
205 |
||
206 |
try { |
|
207 |
||
208 |
Source.scanRoot(Util.pathToFile(options.getGenSrcDir()), Util.set(".java"), null, null, null, null, |
|
209 |
generated_sources, modules, current_module, false, true, false); |
|
210 |
javac_state.now().flattenPackagesSourcesAndArtifacts(modules); |
|
211 |
// Recheck the the source files and their timestamps again. |
|
212 |
javac_state.checkSourceStatus(true); |
|
213 |
||
214 |
// Now do a safety check that the list of source files is identical |
|
215 |
// to the list Make believes we are compiling. If we do not get this |
|
216 |
// right, then incremental builds will fail with subtility. |
|
217 |
// If any difference is detected, then we will fail hard here. |
|
218 |
// This is an important safety net. |
|
219 |
javac_state.compareWithMakefileList(Util.pathToFile(options.getSourceReferenceList())); |
|
220 |
||
221 |
// Do the compilations, repeatedly until no tainted packages exist. |
|
222 |
boolean again; |
|
223 |
// Collect the name of all compiled packages. |
|
224 |
Set<String> recently_compiled = new HashSet<>(); |
|
225 |
boolean[] rc = new boolean[1]; |
|
226 |
||
227 |
CompilationService compilationService = new CompilationService(); |
|
228 |
do { |
|
229 |
if (round > 0) |
|
230 |
printRound(round); |
|
231 |
// Clean out artifacts in tainted packages. |
|
232 |
javac_state.deleteClassArtifactsInTaintedPackages(); |
|
233 |
again = javac_state.performJavaCompilations(compilationService, options, recently_compiled, rc); |
|
234 |
if (!rc[0]) { |
|
235 |
Log.debug("Compilation failed."); |
|
236 |
break; |
|
27388
d694da45bd7a
8062676: Tests which leak lots of file managers should be fixed (group 2)
jjg
parents:
26992
diff
changeset
|
237 |
} |
32335 | 238 |
if (!again) { |
239 |
Log.debug("Nothing left to do."); |
|
240 |
} |
|
241 |
round++; |
|
242 |
} while (again); |
|
243 |
Log.debug("No need to do another round."); |
|
244 |
||
245 |
// Only update the state if the compile went well. |
|
246 |
if (rc[0]) { |
|
247 |
javac_state.save(); |
|
248 |
// Reflatten only the artifacts. |
|
249 |
javac_state.now().flattenArtifacts(modules); |
|
250 |
// Remove artifacts that were generated during the last compile, but not this one. |
|
251 |
javac_state.removeSuperfluousArtifacts(recently_compiled); |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
252 |
} |
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
253 |
|
32335 | 254 |
return new CompilationResult(rc[0] ? 0 : ERROR_FATAL, |
255 |
new String(outBaos.toByteArray(), UTF_8), |
|
256 |
new String(errBaos.toByteArray(), UTF_8)); |
|
257 |
} catch (ProblemException e) { |
|
258 |
Log.error(e.getMessage()); |
|
259 |
return new CompilationResult(ERROR_FATAL, |
|
260 |
new String(outBaos.toByteArray(), UTF_8), |
|
261 |
new String(errBaos.toByteArray(), UTF_8)); |
|
262 |
} catch (Exception e) { |
|
263 |
e.printStackTrace(err); |
|
264 |
return new CompilationResult(ERROR_FATAL, |
|
265 |
new String(outBaos.toByteArray(), UTF_8), |
|
266 |
new String(errBaos.toByteArray(), UTF_8)); |
|
26992
92e69fa21956
8059349: Public API scanning should be implemented in the form of a TaskListener
alundblad
parents:
26991
diff
changeset
|
267 |
} |
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
268 |
} |
26088 | 269 |
|
270 |
@Override |
|
26098
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
271 |
public void shutdown() { |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
272 |
// Nothing to clean up |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
273 |
} |
32588700060b
8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents:
26088
diff
changeset
|
274 |
|
32335 | 275 |
private static boolean validateOptions(Options options) { |
276 |
||
277 |
String err = null; |
|
278 |
||
279 |
if (options.getDestDir() == null) { |
|
280 |
err = "Please specify output directory."; |
|
281 |
} else if (options.isJavaFilesAmongJavacArgs()) { |
|
282 |
err = "Sjavac does not handle explicit compilation of single .java files."; |
|
283 |
} else if (options.getServerConf() == null) { |
|
284 |
err = "No server configuration provided."; |
|
285 |
} else if (!options.getImplicitPolicy().equals("none")) { |
|
286 |
err = "The only allowed setting for sjavac is -implicit:none"; |
|
287 |
} else if (options.getSources().isEmpty()) { |
|
288 |
err = "You have to specify -src."; |
|
289 |
} else if (options.getTranslationRules().size() > 1 |
|
290 |
&& options.getGenSrcDir() == null) { |
|
291 |
err = "You have translators but no gensrc dir (-s) specified!"; |
|
292 |
} |
|
293 |
||
294 |
if (err != null) |
|
295 |
Log.error(err); |
|
296 |
||
297 |
return err == null; |
|
298 |
||
26088 | 299 |
} |
300 |
||
32335 | 301 |
private static boolean createIfMissing(Path dir) { |
302 |
||
303 |
if (Files.isDirectory(dir)) |
|
304 |
return true; |
|
305 |
||
306 |
if (Files.exists(dir)) { |
|
307 |
Log.error(dir + " is not a directory."); |
|
308 |
return false; |
|
309 |
} |
|
310 |
||
311 |
try { |
|
312 |
Files.createDirectories(dir); |
|
313 |
} catch (IOException e) { |
|
314 |
Log.error("Could not create directory: " + e.getMessage()); |
|
315 |
return false; |
|
316 |
} |
|
317 |
||
318 |
return true; |
|
319 |
} |
|
320 |
||
321 |
/** Find source files in the given source locations. */ |
|
322 |
public static void findSourceFiles(List<SourceLocation> sourceLocations, |
|
323 |
Set<String> sourceTypes, |
|
324 |
Map<String,Source> foundFiles, |
|
325 |
Map<String, Module> foundModules, |
|
326 |
Module currentModule, |
|
327 |
boolean permitSourcesInDefaultPackage, |
|
328 |
boolean inLinksrc) { |
|
329 |
||
330 |
for (SourceLocation source : sourceLocations) { |
|
331 |
source.findSourceFiles(sourceTypes, |
|
332 |
foundFiles, |
|
333 |
foundModules, |
|
334 |
currentModule, |
|
335 |
permitSourcesInDefaultPackage, |
|
336 |
inLinksrc); |
|
31115
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
337 |
} |
8d8e98052d5d
8054717: SJavac should track changes in the public apis of classpath classes!
alundblad
parents:
27388
diff
changeset
|
338 |
} |
32335 | 339 |
|
340 |
private static void printRound(int round) { |
|
341 |
Log.debug("****************************************"); |
|
342 |
Log.debug("* Round " + round + " *"); |
|
343 |
Log.debug("****************************************"); |
|
344 |
} |
|
25299
b4a7dcd657f5
8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff
changeset
|
345 |
} |