shrink option in build.xml. specify -Dshrink=false to speed up the build

This commit is contained in:
Leonid Shalupov
2012-05-04 22:49:57 +04:00
parent 765d851b1a
commit 80b96dc949
2 changed files with 100 additions and 72 deletions
+89 -72
View File
@@ -1,5 +1,8 @@
<project name="Kotlin" default="dist"> <project name="Kotlin" default="dist">
<!-- Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build -->
<property name="shrink" value="false" />
<property name="output" value="${basedir}/dist"/> <property name="output" value="${basedir}/dist"/>
<property name="kotlin-home" value="${output}/kotlinc"/> <property name="kotlin-home" value="${output}/kotlinc"/>
<property name="build.number" value="snapshot"/> <property name="build.number" value="snapshot"/>
@@ -87,6 +90,7 @@
<target name="compiler"> <target name="compiler">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${basedir}/dependencies/jarjar.jar"/> <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${basedir}/dependencies/jarjar.jar"/>
<taskdef resource="proguard/ant/task.properties" classpath="${basedir}/dependencies/proguard.jar"/> <taskdef resource="proguard/ant/task.properties" classpath="${basedir}/dependencies/proguard.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/dependencies/ant-contrib.jar"/>
<cleandir dir="${output}/classes/compiler"/> <cleandir dir="${output}/classes/compiler"/>
<javac destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"> <javac destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
@@ -131,25 +135,6 @@
<rule pattern="org.picocontainer.**" result="org.jetbrains.jet.internal.org.picocontainer.@1"/> <rule pattern="org.picocontainer.**" result="org.jetbrains.jet.internal.org.picocontainer.@1"/>
<rule pattern="gnu.trove.**" result="org.jetbrains.jet.internal.gnu.trove.@1"/> <rule pattern="gnu.trove.**" result="org.jetbrains.jet.internal.gnu.trove.@1"/>
<rule pattern="javax.inject.**" result="org.jetbrains.jet.internal.javax.inject.@1"/> <rule pattern="javax.inject.**" result="org.jetbrains.jet.internal.javax.inject.@1"/>
</jarjar>
<delete failonerror="false" dir="${output}/kotlin-compiler.exploded"/>
<mkdir dir="${output}/kotlin-compiler.exploded"/>
<unzip src="${output}/kotlin-compiler-jarjar.jar" dest="${output}/kotlin-compiler.exploded"/>
<delete file="${output}/kotlin-compiler-jarjar.jar"/>
<!-- Clean JarJar result -->
<delete file="${output}/kotlin-compiler-before-proguard.jar.jar" failonerror="false"/>
<jar jarfile="${output}/kotlin-compiler-before-proguard.jar.jar">
<fileset dir="${output}/kotlin-compiler.exploded">
<include name="**/*.class"/>
<include name="**/*.jet"/>
<include name="**/*.jet.src"/>
<include name="**/*.kt"/>
<include name="META-INF/services/**"/>
<include name="messages/**"/>
</fileset>
<manifest> <manifest>
<attribute name="Built-By" value="JetBrains"/> <attribute name="Built-By" value="JetBrains"/>
@@ -160,76 +145,105 @@
<attribute name="Main-Class" value="org.jetbrains.jet.cli.jvm.K2JVMCompiler"/> <attribute name="Main-Class" value="org.jetbrains.jet.cli.jvm.K2JVMCompiler"/>
</manifest> </manifest>
</jar> </jarjar>
<delete dir="${output}/kotlin-compiler.exploded"/>
<available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
<available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
<delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/> <delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
<proguard><![CDATA[
-injars '${output}/kotlin-compiler-before-proguard.jar.jar'
-outjars '${kotlin-home}/lib/kotlin-compiler.jar'
-libraryjars '${rtjar}' <if>
<isfalse value="${shrink}" />
-target 1.6 <then>
-dontoptimize <copy file="${output}/kotlin-compiler-jarjar.jar"
-dontobfuscate tofile="${kotlin-home}/lib/kotlin-compiler.jar" />
</then>
-keepclasseswithmembers public class * { <else>
public static void main(java.lang.String[]); <cleandir dir="${output}/kotlin-compiler.exploded"/>
} <unzip src="${output}/kotlin-compiler-jarjar.jar" dest="${output}/kotlin-compiler.exploded"/>
-keep class org.jetbrains.annotations.** { <!-- Clean JarJar result -->
public protected *; <delete file="${output}/kotlin-compiler-before-proguard.jar" failonerror="false"/>
} <jar jarfile="${output}/kotlin-compiler-before-proguard.jar"
manifest="${output}/kotlin-compiler.exploded/META-INF/MANIFEST.MF">
-keep class org.jetbrains.k2js.** { <fileset dir="${output}/kotlin-compiler.exploded">
public protected *; <include name="**/*.class"/>
} <include name="**/*.jet"/>
<include name="**/*.jet.src"/>
<include name="**/*.kt"/>
<include name="META-INF/services/**"/>
<include name="messages/**"/>
</fileset>
</jar>
<delete dir="${output}/kotlin-compiler.exploded"/>
-keep class org.jetbrains.jet.** { <available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
public protected *; <available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
}
-keep class jet.** { <proguard><![CDATA[
public protected *; -injars '${output}/kotlin-compiler-before-proguard.jar'
} -outjars '${kotlin-home}/lib/kotlin-compiler.jar'
-keepclasseswithmembers class * { void start(); } -libraryjars '${rtjar}'
-keepclasseswithmembers class * { void stop(); } -target 1.6
-keepclasseswithmembers class * { void dispose(); } -dontoptimize
-dontobfuscate
-keepclasseswithmembers class * { ** getFileSystem(); } -keepclasseswithmembers public class * {
-keepclasseswithmembers class * { ** isVarArgs(); } public static void main(java.lang.String[]);
-keepclasseswithmembers class * { ** getApplication(); } }
-keepclasseswithmembers class * { ** finalizeReferent(); }
-keepclasseswithmembers class * { ** newBuilder(); }
-keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
-keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
-keepclasseswithmembers class * { ** getUserData(java.lang.String); }
-keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
-keepclasseswithmembers class * { ** project(); } -keep class org.jetbrains.annotations.** {
public protected *;
}
-keepclasseswithmembers class * { ** TYPE; } -keep class org.jetbrains.k2js.** {
-keepclasseswithmembers class * { ** ourInstance; } public protected *;
}
-keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); } -keep class org.jetbrains.jet.** {
public protected *;
}
-keepclassmembers enum * { -keep class jet.** {
public static **[] values(); public protected *;
public static ** valueOf(java.lang.String); }
}
-keepclassmembers class * { -keepclasseswithmembers class * { void start(); }
** toString();
** hashCode(); -keepclasseswithmembers class * { void stop(); }
} -keepclasseswithmembers class * { void dispose(); }
]]></proguard>
<!--<delete file="${output}/kotlin-compiler-before-proguard.jar"/>--> -keepclasseswithmembers class * { ** getFileSystem(); }
-keepclasseswithmembers class * { ** isVarArgs(); }
-keepclasseswithmembers class * { ** getApplication(); }
-keepclasseswithmembers class * { ** finalizeReferent(); }
-keepclasseswithmembers class * { ** newBuilder(); }
-keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
-keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
-keepclasseswithmembers class * { ** getUserData(java.lang.String); }
-keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
-keepclasseswithmembers class * { ** project(); }
-keepclasseswithmembers class * { ** TYPE; }
-keepclasseswithmembers class * { ** ourInstance; }
-keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); }
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * {
** toString();
** hashCode();
}
]]></proguard>
</else>
</if>
</target> </target>
<target name="antTools"> <target name="antTools">
@@ -248,6 +262,7 @@
</classpath> </classpath>
</javac> </javac>
<delete file="${kotlin-home}/lib/kotlin-ant.jar" failonerror="false" />
<jar destfile="${kotlin-home}/lib/kotlin-ant.jar"> <jar destfile="${kotlin-home}/lib/kotlin-ant.jar">
<fileset dir="${output}/classes/buildTools"/> <fileset dir="${output}/classes/buildTools"/>
<fileset dir="${basedir}/build-tools/ant/src" includes="**/*.xml"/> <fileset dir="${basedir}/build-tools/ant/src" includes="**/*.xml"/>
@@ -269,6 +284,7 @@
<arg value="jdkHeaders"/> <arg value="jdkHeaders"/>
</java> </java>
<delete file="${kotlin-home}/lib/alt/kotlin-jdk-headers.jar" failonerror="false" />
<jar destfile="${kotlin-home}/lib/alt/kotlin-jdk-headers.jar"> <jar destfile="${kotlin-home}/lib/alt/kotlin-jdk-headers.jar">
<fileset dir="${output}/classes/jdk-headers"/> <fileset dir="${output}/classes/jdk-headers"/>
</jar> </jar>
@@ -296,6 +312,7 @@
<arg value="${output}/classes/runtime"/> <arg value="${output}/classes/runtime"/>
</java> </java>
<delete file="${kotlin-home}/lib/kotlin-runtime.jar" failonerror="false" />
<jar destfile="${kotlin-home}/lib/kotlin-runtime.jar"> <jar destfile="${kotlin-home}/lib/kotlin-runtime.jar">
<fileset dir="${output}/classes/runtime"/> <fileset dir="${output}/classes/runtime"/>
<fileset dir="${output}/classes/stdlib"/> <fileset dir="${output}/classes/stdlib"/>
+11
View File
@@ -24,6 +24,17 @@
<mapper type="flatten"/> <mapper type="flatten"/>
</unzip> </unzip>
<!-- ant contrib -->
<get src="http://heanet.dl.sourceforge.net/project/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip" dest="dependencies/download/ant-contrib-1.0b3-bin.zip" usetimestamp="true"/>
<delete file="dependencies/ant-contrib.jar" failonerror="false"/>
<unzip src="dependencies/download/ant-contrib-1.0b3-bin.zip" dest="dependencies">
<patternset>
<include name="ant-contrib/ant-contrib-1.0b3.jar"/>
</patternset>
<mapper type="merge" to="ant-contrib.jar"/>
</unzip>
<!-- JarJar --> <!-- JarJar -->
<get src="http://jarjar.googlecode.com/files/jarjar-1.2.jar" dest="dependencies/download/jarjar-1.2.jar" usetimestamp="true"/> <get src="http://jarjar.googlecode.com/files/jarjar-1.2.jar" dest="dependencies/download/jarjar-1.2.jar" usetimestamp="true"/>
<copy file="dependencies/download/jarjar-1.2.jar" tofile="dependencies/jarjar.jar" overwrite="true" /> <copy file="dependencies/download/jarjar-1.2.jar" tofile="dependencies/jarjar.jar" overwrite="true" />