summaryrefslogtreecommitdiffstats
path: root/push/build.xml
blob: 17bc04a8cf1c115f59466bed20422c944b70130b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0"?>

<project name="vaadin-push" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
    <description>
        Meta package which defines dependencies needed for push
    </description>
    <include file="../build.xml" as="vaadin" />
    <include file="../common.xml" as="common" />

    <property name="module.name" value="vaadin-push" />
    <property name="module.symbolic" value="com.vaadin.push" />
    <property name="result.dir" location="result" />
    <property name="temp.dir" location="${result.dir}/temp" />
    <property name="jquery.unpack" location="${temp.dir}/jquery" />
    <property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" />
    <property name="vaadinPush.debug.js" location="${result.dir}/js/VAADIN/vaadinPush.debug.js" />

    <!-- Keep the version number in sync with ivy.xml, server/src/com/vaadin/server/Constants.java -->
    <property name="atmosphere.runtime.version" value="1.0.18.vaadin3" />
    <property name="jquery.version" value="1.9.0" />

    <path id="classpath.compile.custom" />

    <union id="jar.includes">
        <fileset dir="${result.dir}/js">
            <include name="VAADIN/vaadinPush.js" />
            <include name="VAADIN/vaadinPush.debug.js" />
        </fileset>
    </union>

    <target name="vaadinPush.js">
        <mkdir dir="${result.dir}/js/VAADIN" />
        <ivy:resolve log="download-only" file="ivy.xml" conf="push.js" />
        <ivy:cachepath pathid="atmosphere.jquery.deps" conf="push.js" />

        <delete dir="${temp.dir}" />
        <copy flatten="true" tofile="${temp.dir}/jquery.war">
            <path refid="atmosphere.jquery.deps" />
        </copy>

        <!-- Unzip to temp dir -->
        <unzip src="${temp.dir}/jquery.war" dest="${jquery.unpack}">
            <patternset>
                <include name="**/jquery.atmosphere.js" />
                <include name="**/jquery-${jquery.version}.js" />
            </patternset>
            <mapper type="flatten" />
        </unzip>
        <loadfile srcfile="${jquery.unpack}/jquery-${jquery.version}.js" property="jquery.js.contents" />
        <loadfile srcfile="${jquery.unpack}/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />

        <loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents">
            <filterchain>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="jquery.js" value="${jquery.js.contents}" />
                    <token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
                </replacetokens>
            </filterchain>
        </loadfile>

        <!-- Non-obfuscated version for debugging -->
        <echo file="${vaadinPush.debug.js}">${vaadinPush.js.contents}</echo>

        <!-- Minify -->
        <ivy:retrieve organisation="com.yahoo.platform.yui" module="yuicompressor" revision="2.4.7" inline="true" type="jar" pattern="${result.dir}/compressor.jar" />
        <java jar="${result.dir}/compressor.jar" fork="true">
            <arg value="-v" />
            <arg value="-o" />
            <arg file="${vaadinPush.js}" />
            <arg file="${vaadinPush.debug.js}" />
        </java>
    </target>

    <target name="jar" depends="vaadinPush.js">
        <antcall target="common.jar">
            <param name="require-bundle" value="com.vaadin.external.atmosphere.atmosphere-runtime;bundle-version=&quot;${atmosphere.runtime.version}&quot;;visibility:=reexport" />
            <reference torefid="extra.jar.includes" refid="jar.includes" />
        </antcall>
    </target>

    <target name="publish-local" depends="jar">
        <antcall target="common.publish-local" />
    </target>

    <target name="clean">
        <antcall target="common.clean" />
    </target>
    <target name="checkstyle">
    </target>

    <target name="test" depends="checkstyle">
    </target>
</project>