aboutsummaryrefslogtreecommitdiffstats
path: root/buildhelpers/build.xml
blob: 05b8c8397fd469440cd33099d6f73dfcea165f89 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?xml version="1.0"?>

<project name="vaadin-buildhelpers" basedir="." default="publish-local"
    xmlns:ivy="antlib:org.apache.ivy.ant">
    <description>
        Compiles build helpers used when building other
        modules.
    </description>
    <include file="../build.xml" as="vaadin" />
    <include file="../common.xml" as="common" />

    <property name="module.name" value="vaadin-buildhelpers" />
    <property name="module.symbolic" value="com.vaadin.buildhelpers" />
    <property name="result.dir" location="result" />
    <path id="classpath.compile.custom" />

    <property name="filtered.webcontent.dir" location="${result.dir}/WebContent" />
    <property name="release-notes-tickets-file" location="${result.dir}/release-notes-tickets.html" />
    <property name="release-notes-authors-file" location="${result.dir}/release-notes-authors.html" />

    <target name="jar" depends="filter.webcontent">
        <antcall target="common.compile" />
        <property name="result.jar"
            location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
        <property name="classes" location="${result.dir}/classes" />
        <property name="src" location="${result.dir}/../src" />

        <jar destfile="${result.jar}" duplicate="fail" index="true">
            <fileset dir="${classes}" excludes="${classes.exclude}"
                erroronmissingdir="false" />
            <fileset dir="${filtered.webcontent.dir}/.."
                includes="WebContent/**" />
        </jar>
    </target>

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

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

    <target name="filter.webcontent"
        depends="fetch-release-notes-tickets,fetch-release-notes-authors">
        <!-- Running without build.release-notes will cause an error, which 
            is ignored -->
        <loadfile property="release-notes-tickets" srcFile="${release-notes-tickets-file}"
            failonerror="false" />
        <loadfile property="release-notes-authors" srcFile="${release-notes-authors-file}"
            failonerror="false" />

        <delete dir="${filtered.webcontent.dir}" />
        <copy todir="${filtered.webcontent.dir}">
            <fileset dir="${vaadin.basedir}/WebContent">
                <include name="img/**" />
            </fileset>
        </copy>
        <copy todir="${filtered.webcontent.dir}">
            <fileset dir="${vaadin.basedir}/WebContent">
                <patternset>
                    <include name="release-notes.html" />
                    <include name="license.html" />
                    <include name="licenses/**" />
                    <include name="css/**" />
                </patternset>
            </fileset>
            <filterchain>
                <expandproperties />
                <replacetokens begintoken="@" endtoken="@">
                    <token key="version" value="${vaadin.version}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="version-minor"
                        value="${vaadin.version.major}.${vaadin.version.minor}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="builddate" value="${build.date}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="release-notes-tickets" value="${release-notes-tickets}" />
                </replacetokens>
                <replacetokens begintoken="@" endtoken="@">
                    <token key="release-notes-authors" value="${release-notes-authors}" />
                </replacetokens>
            </filterchain>
        </copy>
    </target>


    <target name="fetch-release-notes-tickets" if="build.release-notes">
        <mkdir dir="${filtered.webcontent.dir}" />
        <antcall target="exec-buildhelper">
            <param name="main.class"
                value="com.vaadin.buildhelpers.FetchReleaseNotesTickets" />
            <param name="output" location="${release-notes-tickets-file}" />
        </antcall>
    </target>

    <target name="fetch-release-notes-authors" if="build.release-notes">
        <copy file="src/com/vaadin/buildhelpers/authormap.properties"
            tofile="${result.dir}/classes/com/vaadin/buildhelpers/authormap.properties" />

        <mkdir dir="${filtered.webcontent.dir}" />
        <antcall target="exec-buildhelper">
            <param name="main.class"
                value="com.vaadin.buildhelpers.FetchReleaseNotesAuthors" />
            <param name="output" location="${release-notes-authors-file}" />
        </antcall>
        <delete
            file="${result.dir}/classes/com/vaadin/buildhelpers/authormap.properties" />
    </target>

    <target name="exec-buildhelper">
        <antcall target="common.compile" />
        <fail unless="main.class" message="No main class given in 'main.class'" />
        <fail unless="output" message="No output file given in 'output'" />
        <ivy:resolve log="download-only" conf="build" />
        <ivy:cachepath pathid="deps" />
        <java classname="${main.class}" output="${output}"
            failonerror="true" fork="yes">
            <classpath>
                <pathelement location="${result.dir}/classes" />
            </classpath>
            <classpath refid="deps" />
            <jvmarg value="-Dvaadin.version=${vaadin.version}" />
        </java>
    </target>

    <target name="checkstyle">
        <antcall target="common.checkstyle">
            <param name="cs.src" location="src" />
        </antcall>
    </target>

    <target name="test" depends="checkstyle">
        <!--<antcall target="common.test.run" /> -->
        <echo>WHAT? No JUnit tests for ${module.name}!</echo>
    </target>
</project>