speedup groovyc a bit: reuse class loader cache from groovy-all.jar and groovy_rt.jar
authorpeter <peter@jetbrains.com>
Thu, 19 Feb 2015 07:24:14 +0000 (08:24 +0100)
committerpeter <peter@jetbrains.com>
Fri, 20 Feb 2015 06:13:36 +0000 (07:13 +0100)
plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java

index 49081b8adc8de1d8d37abb8bd04c957a08edbb73..55b78bd40e18a250a48e5cea63818b95793ff747 100644 (file)
@@ -143,8 +143,15 @@ class InProcessGroovyc implements GroovycFlavor {
       return pair.second;
     }
 
-    UrlClassLoader groovyAllLoader = 
-      UrlClassLoader.build().urls(toUrls(Arrays.asList(GroovyBuilder.getGroovyRtRoot().getPath(), groovyAll))).useCache().get();
+    UrlClassLoader groovyAllLoader = UrlClassLoader.build().
+      urls(toUrls(Arrays.asList(GroovyBuilder.getGroovyRtRoot().getPath(), groovyAll))).
+      useCache(ourLoaderCachePool, new UrlClassLoader.CachingCondition() {
+        @Override
+        public boolean shouldCacheData(
+          @NotNull URL url) {
+          return true;
+        }
+      }).get();
     ClassLoader wrapper = new URLClassLoader(new URL[0], groovyAllLoader) {
       @Override
       protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {