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