From 9a762e0fa282deac1ca48ee15e548325b1e7ab2b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 25 May 2016 14:47:55 +0300 Subject: [PATCH] Prevent META-INF/INDEX.LIST from jsr166e.jar to be packed into compiler INDEX.LIST contains a list of jars with the information about what packages does each of those jars have (this feature is called JarIndex, see http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html). In case of ideaSDK/core/jsr166e.jar, it only has one entry -- jsr166e.jar itself. When the compiler is started, the class loading mechanism reads this file and assumes that there are no other jars nearby. But the compiler depends on other jars, namely kotlin-runtime.jar and kotlin-reflect.jar, thus we get ClassNotFoundException when trying to load almost any Kotlin bytecode from kotlin-compiler.jar. Note that, fortunately, release builds are not affected because: 1) proguard helpfully strips this file from the final kotlin-compiler.jar; 2) we use a custom class loader (Preloader) which ignores JarIndex. This only affects local setup with proguard disabled, where one test (CompilerDaemonTest) was failing because it was trying to invoke the compiler directly via "java -jar ..." To implement this, it was necessary to exclude this one file from the compiler jar, however the "zipgroupfileset" Ant task does not support exclusion of one file from a particular archive, so we pack all idea core libraries into one jar beforehand and use "zipfileset" which supports exclusion of one file (http://stackoverflow.com/a/2426245/288456). (cherry picked from commit c3f1afee626502470dbe27a1343c777e5cade789) --- build.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 73bb58f6391..2f8d4cae4c4 100644 --- a/build.xml +++ b/build.xml @@ -489,6 +489,13 @@ + + + + + + + @@ -507,7 +514,7 @@ - +