提交 e6588ee8 编写于 作者: A Alexander Udalov

CLI: include META-INF/services/ from kotlin-reflect with -include-runtime

This is an addition to bd205317 where we
started to add the contents of kotlin-reflect into the resulting jar if
-include-runtime is specified. Apparently kotlin-reflect doesn't work
without some services in META-INF/services/, which didn't satisfy the
condition for inclusion. The existing test didn't catch that because
loading class annotations does not always lead to those services being
loaded.
上级 3dfd2a95
......@@ -33,7 +33,8 @@ import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.kotlin.utils.PathUtil;
import java.io.*;
import java.util.*;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.jar.*;
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR;
......@@ -144,11 +145,13 @@ public class CompileEnvironmentUtil {
JarEntry e = jis.getNextJarEntry();
if (e == null) break;
if ((!FileUtilRt.extensionEquals(e.getName(), "class") &&
!FileUtilRt.extensionEquals(e.getName(), BuiltInSerializerProtocol.BUILTINS_FILE_EXTENSION)) ||
StringsKt.substringAfterLast(e.getName(), "/", e.getName()).equals("module-info.class")) {
String name = e.getName();
if (!FileUtilRt.extensionEquals(name, "class") &&
!FileUtilRt.extensionEquals(name, BuiltInSerializerProtocol.BUILTINS_FILE_EXTENSION) &&
!name.startsWith("META-INF/services/")) {
continue;
}
if (StringsKt.substringAfterLast(name, "/", name).equals("module-info.class")) continue;
if (resetJarTimestamps) {
e.setTime(DOS_EPOCH);
}
......
package reflect
import kotlin.reflect.jvm.kotlinFunction
fun main() {
String::class.annotations
}
\ No newline at end of file
KotlinVersion::class.java.methods.first().kotlinFunction
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册