diff --git a/build/scripts/download_kotlin.gant b/build/scripts/download_kotlin.gant index a43b6d5eeba6..63d9bc039c7e 100644 --- a/build/scripts/download_kotlin.gant +++ b/build/scripts/download_kotlin.gant @@ -192,14 +192,27 @@ private String readKotlinClassVersionOfCompiledClasses() { private String readKotlinClassFileVersion(InputStream classFileStream) { def reader = new ClassReader(classFileStream) - String kotlinClassVersion = null + String kotlinBytecodeVersion = null + String kotlinMetaDataVersion = null reader.accept(new ClassVisitor(Opcodes.ASM5) { AnnotationVisitor visitAnnotation(String annotationName, boolean b) { if (annotationName == "Lkotlin/jvm/internal/KotlinClass;") { return new AnnotationVisitor(Opcodes.ASM5) { void visit(String name, Object value) { if (name == "version") { - kotlinClassVersion = (value as Integer[]).join(".") + kotlinBytecodeVersion = (value as Integer[]).join(".") + } + } + } + } + else if (annotationName == "Lkotlin/Metadata;") { + return new AnnotationVisitor(Opcodes.ASM5) { + void visit(String name, Object value) { + if (name == "mv") { + kotlinMetaDataVersion = (value as Integer[]).join(".") + } + else if (name == "bv") { + kotlinBytecodeVersion = (value as Integer[]).join(".") } } } @@ -207,7 +220,10 @@ private String readKotlinClassFileVersion(InputStream classFileStream) { return null } }, 0) - return kotlinClassVersion + if (kotlinBytecodeVersion != null && kotlinMetaDataVersion != null) { + kotlinBytecodeVersion = kotlinBytecodeVersion + "." + kotlinMetaDataVersion + } + return kotlinBytecodeVersion } private boolean downloadAndExtract(TeamCityBuildLocator buildLocator, String communityHome, String classVersionOfCompiledClasses) {