Drop unneeded steps from updateDependencies

Do not download closure compiler for ant,
do not rebuild markdown anymore,
do not build protobuf-lite.
This commit is contained in:
Ilya Gorbunov
2017-04-07 02:12:32 +03:00
parent 6e961be1a1
commit e8e8bec342
2 changed files with 8 additions and 172 deletions
@@ -1,84 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.infrastructure
import java.io.File
import java.util.jar.JarFile
import org.jetbrains.org.objectweb.asm.*
/**
* Checks that the two given Kotlin libraries have the same ABI version.
* If versions are equal, returns with exit code 0, otherwise returns with exit code 3.
* Some additional information is printed to stderr
*/
fun loadClassVersions(bytes: ByteArray): Pair<List<Int>, List<Int>>? {
var metadata: IntArray? = null
var bytecode: IntArray? = null
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
if (desc != "Lkotlin/Metadata;") return null
return object : AnnotationVisitor(Opcodes.ASM5) {
override fun visit(name: String, value: Any) {
when (name) {
"mv" -> metadata = value as IntArray
"bv" -> bytecode = value as IntArray
}
}
}
}
}, 0)
return if (metadata != null && bytecode != null) Pair(metadata!!.toList(), bytecode!!.toList()) else null
}
fun loadVersions(library: File): String {
JarFile(library).use { jarFile ->
for (entry in jarFile.entries()) {
if (entry.name.endsWith(".class")) {
val classBytes = jarFile.getInputStream(entry).readBytes()
loadClassVersions(classBytes)?.let {
val (metadata, bytecode) = it
return "metadata = ${metadata.joinToString(".")}, bytecode = ${bytecode.joinToString(".")}"
}
}
}
}
error("No Kotlin classes were found in $library")
}
fun main(args: Array<String>) {
if (args.size != 2) {
error("Usage: kotlinc -script check-library-abi-version.kts <jar-1> <jar-2>")
}
val library1 = File(args[0])
val library2 = File(args[1])
val v1 = loadVersions(library1)
val v2 = loadVersions(library2)
if (v1 != v2) {
System.err.println("ABI versions differ:")
System.err.println(" $library1: $v1")
System.err.println(" $library2: $v2")
System.exit(3)
}
}
main(args)
+8 -88
View File
@@ -247,18 +247,6 @@
<get-maven-library prefix="org/jetbrains/kotlinx" lib="kotlinx-coroutines-core" version="${kotlinx.coroutines.version}"
target.jar.name.base="kotlinx-coroutines-core" server="http://dl.bintray.com/kotlin/kotlinx/"/>
<!-- Closure Compiler -->
<!-- A download url taken from http://code.google.com/p/closure-compiler/wiki/BinaryDownloads -->
<get src="http://dl.google.com/closure-compiler/compiler-20160315.zip"
dest="${dependencies}/download/closure-compiler.zip" usetimestamp="true"/>
<delete file="${dependencies}/closure-compiler.jar" failonerror="false"/>
<unzip src="${dependencies}/download/closure-compiler.zip" dest="${dependencies}">
<patternset>
<include name="compiler.jar"/>
</patternset>
<mapper type="merge" to="closure-compiler.jar"/>
</unzip>
<delete file="${dependencies}/android.jar" failonerror="false"/>
<get src="http://dl-ssl.google.com/android/repository/android-19_r02.zip"
@@ -319,76 +307,16 @@
<get-protobuf-and-rename-packages/>
<download-or-build-markdown-parser/>
<download_teamcity_artifact
teamcity.server.url="https://teamcity.jetbrains.com"
build.locator.request="${markdown.locator}"
artifact.path="markdown_jar/markdown.jar"
dest="${dependencies}/markdown.jar"
usetimestamp="true"
build.number.pattern="\d+\s-\sKotlin\s[\w-+\.]+"
/>
</target>
<macrodef name="download-or-build-markdown-parser">
<sequential>
<download_teamcity_artifact
teamcity.server.url="https://teamcity.jetbrains.com"
build.locator.request="${markdown.locator}"
artifact.path="markdown_jar/markdown.jar"
dest="${dependencies}/markdown.jar"
usetimestamp="true"
build.number.pattern="\d+\s-\sKotlin\s[\w-+\.]+"
/>
<!-- When ABI version changes, the second build should compile markdown-parser manually instead of using the old version -->
<exec executable="${dependencies}/bootstrap-compiler/Kotlin/kotlinc/bin/${kotlinc.executable.path}" failonerror="false"
resultproperty="markdown.abi.incompatible">
<arg value="-cp"/>
<arg value="${dependencies}/bootstrap-compiler/Kotlin/kotlinc/lib/kotlin-compiler.jar"/>
<arg value="-script"/>
<arg value="${generators}/infrastructure/check-library-abi-version.kts"/>
<arg value="${dependencies}/markdown.jar"/>
<arg value="${dependencies}/bootstrap-compiler/Kotlin/kotlinc/lib/kotlin-runtime.jar"/>
</exec>
<local name="markdown.need.recompile" />
<condition property="markdown.need.recompile">
<not>
<equals arg1="${markdown.abi.incompatible}" arg2="0"/>
</not>
</condition>
<sequential if:set="markdown.need.recompile">
<echo message="Recompiling intellij-markdown manually"/>
<length file="${dependencies}/markdown.jar" property="old.markdown.size"/>
<echo message="Size of the incompatible jar: ${old.markdown.size} bytes"/>
<local name="markdown.dir" />
<property name="markdown.dir" value="${dependencies}/intellij-markdown-forKotlin/" />
<get src="https://github.com/valich/intellij-markdown/archive/forKotlin.zip"
dest="${dependencies}/download/markdown-sources.zip" usetimestamp="true"/>
<delete dir="${markdown.dir}" failonerror="false"/>
<unzip src="${dependencies}/download/markdown-sources.zip" dest="${dependencies}"/>
<exec executable="${dependencies}/bootstrap-compiler/Kotlin/kotlinc/bin/${kotlinc.executable.path}" failonerror="true">
<arg value="${markdown.dir}/src"/>
<arg value="-d"/>
<arg value="${markdown.dir}/out"/>
</exec>
<javac srcdir="${markdown.dir}/src"
destdir="${markdown.dir}/out" includeantruntime="false">
<classpath>
<path location="${dependencies}/bootstrap-compiler/Kotlin/kotlinc/lib/kotlin-runtime.jar"/>
</classpath>
</javac>
<delete file="${dependencies}/markdown.jar" failonerror="false"/>
<jar jarfile="${dependencies}/markdown.jar">
<fileset dir="${markdown.dir}/out" includes="**"/>
</jar>
<echo message="Compilation of intellij-markdown finished"/>
<length file="${dependencies}/markdown.jar" property="new.markdown.size"/>
<echo message="Size of the new jar: ${new.markdown.size} bytes"/>
</sequential>
</sequential>
</macrodef>
<macrodef name="get-protobuf-and-rename-packages">
<sequential>
<macrodef name="rename-packages-in-binaries">
@@ -448,14 +376,6 @@
source.jar="${dependencies}/download/protobuf-java-${protobuf.version}-sources.jar"
target.jar="${dependencies}/protobuf-${protobuf.version}-sources.jar"
/>
<!-- Build protobuf lite jar -->
<exec executable="${dependencies}/bootstrap-compiler/Kotlin/kotlinc/bin/${kotlinc.executable.path}" failonerror="true">
<arg value="-script"/>
<arg value="${generators}/infrastructure/build-protobuf-lite.kts"/>
<arg value="${dependencies}/protobuf-${protobuf.version}.jar"/>
<arg value="${dependencies}/protobuf-${protobuf.version}-lite.jar"/>
</exec>
</sequential>
</macrodef>