| <?xml version="1.0" encoding="utf-8" ?> |
| <!-- |
| Copyright 2014 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| <project name="DomDistiller" default="build" basedir="."> |
| <property environment="env"/> |
| <!-- Arguments to gwtc and devmode targets --> |
| <property name="gwt.args" value="-XclosureCompiler -XnoclassMetadata -XnocheckCasts -style OBF" /> |
| <property |
| name="gwt.test.args" |
| value=" |
| -XnoclosureCompiler -optimize 0 -draftCompile |
| -style DETAILED |
| -saveSource -saveSourceOutput out/debug |
| -XmethodNameDisplayMode ABBREVIATED |
| "/> |
| <property name="gwt.shared.args" value="-failOnError -war war -XjsInteropMode JS -gen out/gen" /> |
| <property name="gwt.custom.args" value="" /> |
| |
| <!-- Configure path to GWT SDK --> |
| <property name="gwt.sdk" location="third_party/gwt-2.7.0" /> |
| |
| <property name="test.filter" value="*" /> |
| |
| <property name="test.repeat" value="1" /> |
| |
| <property name="test.debug_level" value="0" /> |
| |
| <property name="test.shuffle" value="0" /> |
| |
| <property name="test.no_sandbox" value="0" /> |
| |
| <condition property="isLinux"> |
| <and> |
| <os family="unix" /> |
| |
| <not> |
| <os family="mac" /> |
| </not> |
| </and> |
| </condition> |
| |
| <condition property="isMac"> |
| <os family="mac" /> |
| </condition> |
| |
| <path id="project.class.path"> |
| <pathelement location="war/WEB-INF/classes"/> |
| <pathelement location="${gwt.sdk}/gwt-user.jar"/> |
| <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/> |
| <pathelement location="" /> |
| </path> |
| |
| <target name="setup"> |
| <mkdir dir="out"/> |
| <mkdir dir="out/gen"/> |
| <mkdir dir="out/debug"/> |
| </target> |
| |
| <path id="project.java.path"> |
| <pathelement location="java"/> |
| </path> |
| |
| <path id="project.java.test.path"> |
| <pathelement location="test" /> |
| <pathelement location="war/WEB-INF/test/classes"/> |
| </path> |
| |
| <path id="project.java.jstest.path"> |
| <pathelement location="javatests" /> |
| <pathelement location="war/WEB-INF/jstest/classes"/> |
| </path> |
| |
| <path id="protoc.java.output"> |
| <pathelement location="out/proto/java" /> |
| </path> |
| |
| <path id="protoc.test.java.output"> |
| <pathelement location="out/test/proto" /> |
| </path> |
| |
| <target name="protoc.plugin.base" |
| description="Generate proto stuff needed for the gwt_overlay plugin"> |
| <mkdir dir="out/proto/python" /> |
| <exec executable="protoc" failonerror="true"> |
| <arg value="--python_out=out/proto/python"/> |
| <arg value="--proto_path=third_party/protobuf"/> |
| <arg value="third_party/protobuf/google/protobuf/compiler/plugin.proto"/> |
| </exec> |
| </target> |
| |
| <target name="protoc" depends="protoc.plugin.base" |
| description="Generate JavascriptObject proto classes"> |
| <mkdir dir="out/proto/java" /> |
| <apply executable="protoc" failonerror="true" relative="true"> |
| <arg value="--plugin=protoc-gen-gwt_overlay=protoc_plugins/gwt_overlay.py"/> |
| <arg value="--gwt_overlay_out=out/proto/java"/> |
| <arg value="--proto_path=proto"/> |
| <fileset dir="." includes="proto/**/*.proto"/> |
| </apply> |
| </target> |
| |
| <target name="protoc.json" depends="protoc.plugin.base" |
| description="Generate base::Value-based json proto reader/writers"> |
| <mkdir dir="out/proto/json" /> |
| <apply executable="protoc" failonerror="true" relative="true"> |
| <arg value="--plugin=protoc-gen-json_converter=protoc_plugins/json_values_converter.py"/> |
| <arg value="--json_converter_out=output_dir=third_party/dom_distiller_js:out/proto/json"/> |
| <arg value="--proto_path=proto"/> |
| <fileset dir="." includes="proto/**/*.proto"/> |
| </apply> |
| </target> |
| |
| <target name="javac" depends="setup, protoc" description="Compile java source to bytecode"> |
| <mkdir dir="war/WEB-INF/classes"/> |
| <javac includes="**" encoding="utf-8" |
| destdir="war/WEB-INF/classes" |
| source="1.7" target="1.7" nowarn="true" |
| debug="true" debuglevel="lines,vars,source"> |
| <src refid="project.java.path"/> |
| <src refid="protoc.java.output" /> |
| <classpath refid="project.class.path"/> |
| </javac> |
| </target> |
| |
| <target name="gwtc" depends="javac" description="GWT compile to JavaScript (production mode)"> |
| <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> |
| <classpath> |
| <path refid="project.java.path"/> |
| <path refid="project.class.path"/> |
| <path refid="protoc.java.output" /> |
| <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" /> |
| <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" /> |
| </classpath> |
| <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError --> |
| <jvmarg value="-Xmx256M"/> |
| <!-- Additional arguments like -style PRETTY or -logLevel DEBUG --> |
| <arg line="${gwt.shared.args}"/> |
| <arg line="${gwt.args}"/> |
| <arg line="${gwt.custom.args}"/> |
| <arg value="DomDistiller"/> |
| </java> |
| </target> |
| |
| <target name="extractwrappedjs" depends="gwtc" |
| description="Create wrapped standalone JavaScript from compiled JavaScript for direct inclusion in Chrome"> |
| <exec executable="python" failonerror="true"> |
| <arg value="create_wrapped_standalone_js.py"/> |
| <arg value="--templatefile=war/wrapped_domdistiller_template.js"/> |
| <arg value="--infile=war/domdistiller/domdistiller.nocache.js"/> |
| <arg value="--outfile=out/domdistiller_wrapped.js"/> |
| </exec> |
| </target> |
| |
| <target name="package" depends="gwtc, extractwrappedjs, gwtc.jstests, protoc.json" |
| description="Copy the main build artifacts into the out/package directory" > |
| <mkdir dir="out/extension"/> |
| <mkdir dir="out/package"/> |
| <mkdir dir="out/package/js"/> |
| <mkdir dir="out/package/proto"/> |
| <mkdir dir="out/package/test"/> |
| <mkdir dir="out/package/test/data"/> |
| <mkdir dir="out/package/test/data/war"/> |
| |
| <copy file="war/domdistiller/domdistiller.nocache.js" tofile="out/package/js/domdistiller.js" /> |
| <copy file="out/domdistiller_wrapped.js" todir="out/package/js" /> |
| <copy todir="out/package/proto_gen"> |
| <fileset dir="out/proto/json"/> |
| </copy> |
| <copy todir="out/package/proto"> |
| <fileset dir="proto"/> |
| </copy> |
| |
| <copy file="war/domdistiller/domdistiller.nocache.js" tofile="out/extension/domdistiller.js" /> |
| <copy todir="out/extension"> |
| <fileset dir="extension"/> |
| </copy> |
| |
| <copy file="war/domdistillerjstest/domdistillerjstest.nocache.js" todir="out/package/test/data/war/domdistillerjstest" /> |
| <copy file="war/test.html" todir="out/package/test/data/war" /> |
| </target> |
| |
| |
| <target name="protoc.tests" depends="protoc.plugin.base" description="Generate test proto code"> |
| <mkdir dir="out/test/proto" /> |
| <apply executable="protoc" failonerror="true" relative="true"> |
| <arg value="--plugin=protoc-gen-gwt_overlay=protoc_plugins/gwt_overlay.py"/> |
| <arg value="--gwt_overlay_out=out/test/proto"/> |
| <arg value="--proto_path=test/proto"/> |
| <fileset dir="." includes="test/proto/**/*.proto"/> |
| </apply> |
| </target> |
| |
| <target name="javac.jstests" depends="javac, protoc.tests" description="Compile test code"> |
| <mkdir dir="war/WEB-INF/jstest/classes"/> |
| <javac includes="**" encoding="utf-8" |
| source="1.7" target="1.7" nowarn="true" |
| destdir="war/WEB-INF/jstest/classes" |
| debug="true" debuglevel="lines,vars,source"> |
| <src refid="project.java.jstest.path" /> |
| <src refid="protoc.test.java.output" /> |
| <classpath refid="project.class.path"/> |
| </javac> |
| </target> |
| |
| <target name="gwtc.jstests" depends="javac.jstests" description="GWT compile to JavaScript (production mode)"> |
| <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> |
| <classpath> |
| <path refid="project.class.path"/> |
| <path refid="project.java.path"/> |
| <path refid="project.java.jstest.path" /> |
| <path refid="protoc.java.output" /> |
| <pathelement location="tools" /> |
| <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" /> |
| <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" /> |
| </classpath> |
| <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError --> |
| <jvmarg value="-Xmx256M"/> |
| <!-- Additional arguments like -style PRETTY or -logLevel DEBUG --> |
| <arg line="${gwt.shared.args}"/> |
| <arg line="${gwt.test.args}"/> |
| <arg line="${gwt.custom.args}"/> |
| <arg value="DomDistillerJsTest"/> |
| </java> |
| </target> |
| |
| |
| <!-- Run jstests for the Linux platform --> |
| <target name="-jstests.linux" if="isLinux"> |
| <exec executable="xvfb-run" failonerror="true"> |
| <env key="PATH" path="${basedir}/buildtools:${env.PATH}"/> |
| <arg value="--auto-servernum"/> |
| <arg value="-s"/> |
| <arg value="-screen 0 1024x768x24"/> |
| <arg value="./run_jstests.py"/> |
| <arg line="--filter=${test.filter} |
| --debug_level ${test.debug_level} |
| --no_sandbox ${test.no_sandbox} |
| --shuffle ${test.shuffle} |
| --repeat ${test.repeat}"/> |
| </exec> |
| </target> |
| |
| <!-- Run jstests for the Mac OS X platform --> |
| <target name="-jstests.mac" if="isMac"> |
| <exec executable="python" failonerror="true"> |
| <env key="PATH" path="${basedir}/buildtools:${env.PATH}"/> |
| <arg value="./run_jstests.py"/> |
| <arg line="--filter=${test.filter} |
| --debug_level ${test.debug_level} |
| --shuffle ${test.shuffle} |
| --repeat ${test.repeat}"/> |
| </exec> |
| </target> |
| |
| <!-- Run jstests --> |
| <target name="-jstests" depends="-jstests.linux, -jstests.mac" /> |
| |
| <target name="test" |
| depends="gwtc.jstests, -jstests" |
| description="Run tests"> |
| </target> |
| |
| <target name="runtest" |
| depends="-jstests" |
| description="Run tests without recompilation"> |
| </target> |
| |
| <target name="build" depends="gwtc" description="Build this project" /> |
| |
| <target name="javadoc"> |
| <javadoc |
| destdir="out/javadoc" |
| sourcepathref="project.java.path" |
| classpathref="project.class.path"> |
| </javadoc> |
| </target> |
| |
| <target name="clean" description="Clean this project"> |
| <delete dir="war/WEB-INF" failonerror="false" /> |
| <delete dir="war/domdistiller" failonerror="false" /> |
| <delete dir="war/domdistillerjs" failonerror="false" /> |
| <delete dir="war/domdistillerjstest" failonerror="false" /> |
| <delete file="war/DomDistiller.war" failonerror="false" /> |
| <delete dir="gwt-unitCache" failonerror="false" /> |
| <delete dir="out" failonerror="false" /> |
| <delete failonerror="false" includeemptydirs="true"> |
| <fileset dir="war" includes="*JUnit/**"/> |
| </delete> |
| </target> |
| |
| </project> |