diff options
Diffstat (limited to 'build/build.xml')
-rw-r--r-- | build/build.xml | 178 |
1 files changed, 167 insertions, 11 deletions
diff --git a/build/build.xml b/build/build.xml index 9b79683bcf..800de09db2 100644 --- a/build/build.xml +++ b/build/build.xml @@ -34,16 +34,60 @@ <path id="additional.jar.path"> <fileset dir="build" includes="lib/**/*.jar" ></fileset> </path> + + <property name="gwt.build.dir" value="${gwt.root}/build"/> + <property name="gwt.tools" value="${gwt.root}/../tools"/> + <property name="gwt.tools.lib" value="${gwt.tools}/lib"/> + + <property name="gwt.user.jar" value="${gwt.build.dir}/lib/gwt-user.jar"/> + <property name="gwt.dev.jar" value="${gwt.build.dir}/lib/gwt-dev.jar"/> + <property name="gwt.codeserver.jar" value="${gwt.build.dir}/lib/gwt-codeserver.jar"/> + + <property name="gwt.user.dir" value="${gwt.root}/user"/> + <property name="gwt.user.bin" value="${gwt.build.dir}/out/user/bin"/> + + <property name="jarjar-jar" value="${gwt.tools.lib}/tonicsystems/jarjar-1.0rc8.jar"/> + <path id="compile.classpath.server-side"> <path refid="additional.jar.path" /> + + <!-- GWT --> + <pathelement location="${gwt.user.jar}" /> + <pathelement location="${gwt.dev.jar}" /> + + <!-- GWT dependencies --> + <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" /> + <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" /> + <path refid="ivy.compile.classpath.server-side" /> </path> <path id="compile.classpath.client-side"> - <path refid="additional.jar.path" /> - <path refid="ivy.compile.classpath.client-side" /> + <path refid="additional.jar.path" /> + + <!-- GWT user --> + <!-- + <pathelement path="${gwt.user.dir}/src" /> + <pathelement path="${gwt.user.dir}/super" /> + <pathelement path="${gwt.user.dir}/out/user/bin"/> + --> + <!-- GWT --> + <pathelement location="${gwt.user.jar}" /> + <pathelement location="${gwt.dev.jar}" /> + + <!-- GWT dependencies --> + <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" /> + <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" /> + + <path refid="ivy.compile.classpath.client-side" /> </path> <path id="compile.classpath.server-side-tests"> <path refid="additional.jar.path" /> + + <!-- GWT --> + <pathelement location="${gwt.user.jar}" /> + <!-- needed at least for Apache Commons --> + <pathelement location="${gwt.dev.jar}" /> + <path refid="ivy.compile.classpath.server-side-tests" /> </path> </target> @@ -68,6 +112,7 @@ <property name="result-classes-core" value="${result-path}/classes/core"/> <property name="result-classes-junit" value="${result-path}/classes/junit"/> <property name="result-classes-testbench" value="${result-path}/classes/testbench"/> + <property name="result-precompiled-widgetsets" value="${result-path}/classes/widgetsets"/> <!-- Folder where Emma instrumented classes are placed (if Emma is used)--> <property name="result-classes-core-for-emma-war" value="${result-path}/classes/emma-war"/> <property name="result-classes-core-for-emma-junit" value="${result-path}/classes/emma-junit"/> @@ -77,6 +122,7 @@ <path refid="compile.classpath.client-side" /> <pathelement location="${result-classes-core}" /> <pathelement location="${result-src-core}" /> + <pathelement location="${result-precompiled-widgetsets}" /> </path> </target> <target name="clean-all" depends="clean-result"> @@ -265,7 +311,7 @@ description="Build package required files, without packing them."> </target> - <target name="compile-server-side" depends="compile-core, webcontent"/> + <target name="compile-server-side" depends="compile-gwt, compile-core, webcontent"/> <!-- Copy and preprocess sources for packaging NOTE: Replaces <version></version> tags with build version tag for some "textual" files @@ -516,6 +562,22 @@ <property name="widgetset-extraParams" value="" /> <echo>Compiling widgetset ${widgetset}. Output directory: ${widgetsets-output-dir}</echo> <mkdir dir="${widgetsets-output-dir}"/> + + <!-- Disabled to reduce JAR size: precompile the widgetset to a .gwtar file --> + <!-- + <java classname="com.google.gwt.dev.CompileModule" classpathref="compile.classpath.widgetset" failonerror="yes" fork="yes" maxmemory="512m"> + <arg value="-out" /> + <arg value="${result-precompiled-widgetsets}" /> + <arg value="-strict" /> + <arg value="${widgetset}" /> + + <jvmarg value="-Xss8M"/> + <jvmarg value="-XX:MaxPermSize=256M"/> + <jvmarg value="-Djava.awt.headless=true"/> + </java> + --> + + <!-- compile the widgetset --> <java classname="com.google.gwt.dev.Compiler" classpathref="compile.classpath.widgetset" failonerror="yes" fork="yes" maxmemory="512m"> <arg value="-war" /> <arg value="${widgetsets-output-dir}" /> @@ -524,13 +586,14 @@ <arg value="-strict" /> <arg value="-localWorkers" /> <arg value="${widgetset-localWorkers}" /> - <arg line="${widgetset-extraParams}" /> + <arg line="${widgetset-extraParams}" /> <arg value="${widgetset}" /> <jvmarg value="-Xss8M"/> <jvmarg value="-XX:MaxPermSize=256M"/> <jvmarg value="-Djava.awt.headless=true"/> </java> + <antcall target="remove-widgetset-gwt-tmp"/> <echo>Compiled ${widgetset}</echo> @@ -566,7 +629,7 @@ <!-- Compiles all widgetsets. --> <!-- This is called when building packages and when compiling all --> <!-- widgetsets, but not when compiling individual widgetsets. --> - <target name="compile-client-side" depends="compile-server-side, compile-tests"> + <target name="compile-client-side" depends="compile-gwt, compile-server-side, compile-tests"> <echo>Compiling widget sets in parallel.</echo> <parallel threadsperprocessor="1"> <antcall inheritrefs="true" target="compile-widgetset-default"/> @@ -596,6 +659,20 @@ <!-- Libraries and Tests --> <!-- ================================================================== --> + <target name="compile-gwt" depends="init"> + <!-- Compile GWT in a directory defined by properties --> + <ant antfile="${gwt.root}/build.xml" target="user" dir="${gwt.root}" inheritall="false" inheritrefs="false"> + <property name="gwt.root" value="${gwt.root}"/> + </ant> + <ant antfile="${gwt.root}/build.xml" target="dev" dir="${gwt.root}" inheritall="false" inheritrefs="false"> + <property name="gwt.root" value="${gwt.root}"/> + </ant> + <!-- TODO unnecessary with latest trunk? --> + <ant antfile="${gwt.root}/dev/codeserver/build.xml" target="build" dir="${gwt.root}/dev/codeserver" inheritall="false" inheritrefs="false"> + <property name="gwt.root" value="${gwt.root}"/> + </ant> + </target> + <!-- Compile the Vaadin library JAR. --> <!-- Need only the default widgetset for this, but can't depend --> <!-- specifically on it, because dependence does not see compiled --> @@ -606,7 +683,6 @@ <!-- Create Vaadin JAR --> <mkdir dir="${output-dir}/META-INF"/> <echo file="${output-dir}/META-INF/VERSION">${version.full}</echo> - <echo file="${output-dir}/META-INF/GWT-VERSION">${gwt-version}</echo> <emma enabled="${emma.enabled}" > <instr instrpath="${result-classes-core}" @@ -618,10 +694,13 @@ <filter includes="com.vaadin.*" /> <filter excludes="com.vaadin.terminal.gwt.*" /> </instr> - </emma> + </emma> - <jar jarfile="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" - compress="true" manifest="build/package/META-INF/MANIFEST.MF" duplicate="preserve"> + <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" + classpath="${jarjar-jar}"/> + + <jarjar jarfile="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" + compress="true" manifest="build/package/META-INF/MANIFEST.MF" duplicate="preserve" index="true"> <metainf dir="${output-dir}/META-INF"/> <manifest> <attribute name="Vaadin-Package-Version" value="1" /> @@ -629,7 +708,8 @@ <attribute name="Implementation-Vendor" value="Vaadin Ltd" /> <attribute name="Implementation-URL" value="http://vaadin.com" /> <attribute name="Implementation-Version" value="${version.full}" /> - <attribute name="GWT-Version" value="${gwt-version}" /> + <!-- No separate GWT-Version attribute or file --> + <!-- <attribute name="GWT-Version" value="${gwt-version}" /> --> <attribute name="GWT-Version-Dependencies" value="${gwt-version-dependencies}" /> <attribute name="Bundle-Version" value="${version.full}" /> </manifest> @@ -654,7 +734,83 @@ <include name="img/**" /> </patternset> </fileset> - </jar> + + <!-- Precompiled widgetset (.gwtar file) not included to limit JAR size --> + <!-- <fileset dir="${result-precompiled-widgetsets}" includes="com/vaadin/terminal.gwt.DefaultWidgetSet.gwtar" /> --> + + <!-- TODO GWT related license files etc. should be in subdirectories --> + + <!-- GWT --> + <fileset dir="${gwt.user.dir}/src" excludes="**/package.html" /> + <fileset dir="${gwt.user.dir}/super" excludes="**/package.html" /> + <!-- Precompiled GWT modules (.gwtar file) not included to limit JAR size --> + <fileset dir="${gwt.user.bin}" excludes="**/*.gwtar" /> + + <zipfileset src="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" /> + <zipfileset src="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" /> + <zipfileset src="${gwt.tools.lib}/streamhtmlparser/streamhtmlparser-jsilver-r10/streamhtmlparser-jsilver-r10-1.5-rebased.jar" /> + + <!-- GWT development JAR contents including many external dependencies --> + <zipfileset src="${gwt.dev.jar}" excludes="javax/servlet/**,javax/xml/**" /> + + <!-- Alternative approach: GWT compiler and its dependencies only from the dev JAR --> + <!-- + <zipfileset src="${gwt.dev.jar}"> + <include name="com/google/gwt/core/client/**"/> + <include name="com/google/gwt/core/shared/**"/> + + <include name="com/google/gwt/core/ext/**"/> + <include name="com/google/gwt/core/linker/**"/> + <include name="com/google/gwt/dev/About.java"/> + <include name="com/google/gwt/dev/GwtVersion.java"/> + <include name="com/google/gwt/dev/Permutation.java"/> + <include name="com/google/gwt/dev/asm/**"/> + <include name="com/google/gwt/dev/cfg/**"/> + <include name="com/google/gwt/dev/javac/**"/> + <include name="com/google/gwt/dev/jdt/**"/> + <include name="com/google/gwt/dev/jjs/**"/> + <include name="com/google/gwt/dev/js/**"/> + <include name="com/google/gwt/dev/json/**"/> + <include name="com/google/gwt/dev/resource/**"/> + <include name="com/google/gwt/dev/util/**"/> + <include name="com/google/gwt/soyc/**"/> + <include name="com/google/gwt/util/**"/> + <include name="org/eclipse/jdt/**"/> + </zipfileset> + <zipfileset src="${gwt.tools.lib}/apache/ant-1.6.5.jar" /> + <zipfileset src="${gwt.tools.lib}/eclipse/jdt-3.4.2_r894.jar" /> + <zipfileset src="${gwt.tools.lib}/tomcat/commons-collections-3.1.jar" /> + <zipfileset src="${gwt.tools.lib}/guava/guava-10.0.1/guava-10.0.1-rebased.jar" /> + <zipfileset src="${gwt.tools.lib}/jscomp/r1649/compiler-rebased.jar" /> + --> + + <!-- GWT SuperDevMode --> + <zipfileset src="${gwt.codeserver.jar}" /> + + <!-- jarjar rules: rebase packages from gwt-dev.jar but not those from gwt-user --> + + <!-- Don't rebase these --> + <!-- xalan is used via reflection --> + <rule pattern="org.apache.xalan.**" result="@0"/> + <rule pattern="org.apache.xml.**" result="@0"/> + <!-- Cannot rebase - used in APIs etc. --> + <!-- <rule pattern="org.mortbay.**" result="@0"/> --> + <!-- <rule pattern="org.xml.**" result="@0"/> --> + + <!-- Rebase these --> + <rule pattern="com.gargoylesoftware.**" result="com.vaadin.external.@0"/> + <rule pattern="com.ibm.**" result="com.vaadin.external.@0"/> + <rule pattern="com.steadystate.**" result="com.vaadin.external.@0"/> + <rule pattern="mx4j.**" result="com.vaadin.external.@0"/> + <rule pattern="net.sourceforge.htmlunit.**" result="com.vaadin.external.@0"/> + <rule pattern="org.apache.**" result="com.vaadin.external.@0"/> + <rule pattern="org.cyberneko.**" result="com.vaadin.external.@0"/> + <rule pattern="org.eclipse.**" result="com.vaadin.external.@0"/> + <!-- looked up based on class name? --> + <rule pattern="org.hibernate.validator.**" result="com.vaadin.external.@0"/> + <rule pattern="org.jdesktop.swingworker.**" result="com.vaadin.external.@0"/> + <rule pattern="org.kohsuke.args4j.**" result="com.vaadin.external.@0"/> + </jarjar> <!-- Generate the Export-Package attribute in the manifest of the JAR --> <java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes"> |