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)
This commit is contained in:
@@ -489,6 +489,13 @@
|
||||
<attribute name="compress" default="true"/>
|
||||
|
||||
<sequential>
|
||||
<local name="idea.core.uberjar.exists"/>
|
||||
<available file="${dependencies.dir}/idea/idea-core-all.jar" property="idea.core.uberjar.exists"/>
|
||||
<!-- TODO: move this jar creation to update_dependencies.xml eventually -->
|
||||
<jar jarfile="${dependencies.dir}/idea/idea-core-all.jar" unless:true="${idea.core.uberjar.exists}">
|
||||
<zipgroupfileset dir="${idea.sdk}/core" includes="*.jar" excludes="util.jar"/>
|
||||
</jar>
|
||||
|
||||
<jar jarfile="@{jarfile}" compress="@{compress}" duplicate="preserve">
|
||||
<fileset dir="${output}/classes/compiler"/>
|
||||
<fileset dir="${output}/builtins">
|
||||
@@ -507,7 +514,7 @@
|
||||
</fileset>
|
||||
|
||||
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
|
||||
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
|
||||
<zipfileset src="${dependencies.dir}/idea/idea-core-all.jar" excludes="META-INF/INDEX.LIST"/>
|
||||
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
|
||||
<zipfileset src="${idea.sdk}/lib/oromatcher.jar"/>
|
||||
<zipfileset src="${idea.sdk}/jps/jps-model.jar"/>
|
||||
|
||||
Reference in New Issue
Block a user