MCPcopy Index your code
hub / github.com/apache/groovy / compileAllTo

Method compileAllTo

src/main/java/org/apache/groovy/util/JavaShell.java:246–262  ·  view source on GitHub ↗

Compile src and write each resulting class file beneath outputDir as a standard package directory tree (e.g. com.example.Foo$Bar becomes /com/example/Foo$Bar.class). Intermediate directories are created as needed; existing class files at those locations are

(String className, Iterable<String> options,
                                           String src, Path outputDir)

Source from the content-addressed store, hash-verified

244 * @since 6.0.0
245 */
246 @Incubating
247 public Map<String, Path> compileAllTo(String className, Iterable<String> options,
248 String src, Path outputDir)
249 throws IOException {
250 doCompile(className, src, options); // populates jscl's classMap
251
252 Map<String, byte[]> classes = jscl.getClassMap(); // already public internally
253 Map<String, Path> written = new LinkedHashMap<>();
254 for (Map.Entry<String, byte[]> e : classes.entrySet()) {
255 // binary name -> relative path: com.example.Foo$Bar -> com/example/Foo$Bar.class
256 Path target = outputDir.resolve(e.getKey().replace('.', '/') + ".class");
257 Files.createDirectories(target.getParent() == null ? outputDir : target.getParent());
258 Files.write(target, e.getValue()); // CREATE + TRUNCATE_EXISTING by default
259 written.put(e.getKey(), target);
260 }
261 return written;
262 }
263
264 /**
265 * Convenience overload of {@link #compileAllTo(String, Iterable, String, Path)} that

Callers

nothing calls this directly

Calls 10

doCompileMethod · 0.95
resolveMethod · 0.65
getKeyMethod · 0.65
getParentMethod · 0.65
writeMethod · 0.65
getValueMethod · 0.65
putMethod · 0.65
getClassMapMethod · 0.45
entrySetMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected