aboutsummaryrefslogtreecommitdiff
path: root/build.xml
blob: 34aead58766ba70704cfd8ba93886955dbe04410 (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
<project name="Dokka" default="build">
    <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.compiler}/lib/kotlin-ant.jar"/>
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" classpath="${basedir}/lib/maven-ant-tasks-2.1.3.jar"/>

    <property name="kotlinc.repeat" value="1"/>

    <target name="clean">
        <delete dir="out" />
        <delete dir="maven-plugin/target" />
        <delete dir="dokka-fatjar/build" />
        <delete dir="dokka-fatjar/.gradle" />
        <delete dir="gradle-plugin/build" />
        <delete dir="gradle-plugin/.gradle" />
    </target>

    <target name="build">
        <mkdir dir="out"/>

        <kotlinc src="src" output="out/dokka.jar">
            <compilerArg value="-Xrepeat"/>
            <compilerArg value="${kotlinc.repeat}"/>
            <classpath>
                <fileset dir="lib" includes="*.jar"/>
            </classpath>
        </kotlinc>

        <jar jarfile="out/dokka.jar" update="true" >
            <zipfileset dir="resources" includes="**/*.properties"/>
        </jar>

        <kotlinc src="ant/src" output="out/dokka-ant.jar" includeRuntime="false">
            <compilerArg value="-Xrepeat"/>
            <compilerArg value="${kotlinc.repeat}"/>
            <classpath>
                <fileset dir="lib" includes="*.jar"/>
                <fileset dir="out" includes="dokka.jar" />
            </classpath>
        </kotlinc>

        <jar jarfile="out/dokka-ant.jar" update="true" >
            <zipfileset dir="ant/src" includes="*.xml"/>
        </jar>
    </target>

    <target name="zip" depends="build">
        <zip zipfile="out/dokka.zip">
            <zipfileset dir="lib" prefix="lib">
                <include name="*.jar"/>
                <exclude name="junit*.jar"/>
                <exclude name="hamcrest*.jar"/>
                <exclude name="maven-ant-tasks*.jar"/>
            </zipfileset>
            <zipfileset dir="out" prefix="lib">
                <include name="dokka.jar"/>
                <include name="dokka-ant.jar"/>
            </zipfileset>
        </zip>
    </target>

    <target name="test" depends="build">
        <mkdir dir="out/test"/>

        <kotlinc src="test/src" output="out/test">
            <classpath>
                <fileset dir="lib" includes="*.jar"/>
                <fileset dir="out" includes="dokka.jar" />
            </classpath>
        </kotlinc>

        <junit fork="true">
            <classpath>
                <fileset dir="lib" includes="*.jar"/>
                <fileset dir="out" includes="dokka.jar" />
                <pathelement path="out/test"/>
            </classpath>
            <batchtest>
                <fileset dir="out/test" includes="**/*Test.class"/>
            </batchtest>
        </junit>
    </target>

    <target name="fatjar" depends="build">
        <exec executable="${basedir}/dokka-fatjar/gradlew" dir="dokka-fatjar" osfamily="unix" failonerror="true">
            <arg value="assemble" />
        </exec>
        <exec executable="cmd.exe" dir="dokka-fatjar" osfamily="windows" failonerror="true">
            <arg line="/c ${basedir}\dokka-fatjar\gradlew.bat assemble" />
        </exec>
    </target>

    <target name="install-fj" depends="fatjar">
        <exec executable="${basedir}/dokka-fatjar/gradlew" dir="dokka-fatjar" osfamily="unix" failonerror="true">
            <arg value="assemble" />
            <arg value="publishToMavenLocal" />
        </exec>
        <exec executable="cmd.exe" dir="dokka-fatjar" osfamily="windows" failonerror="true">
            <arg line="/c ${basedir}\dokka-fatjar\gradlew.bat assemble publishToMavenLocal" />
        </exec>
    </target>

    <target name="gradle-install" depends="install-fj">
        <exec executable="${basedir}/gradle-plugin/gradlew" dir="gradle-plugin" osfamily="unix" failonerror="true">
            <arg value="assemble" />
            <arg value="publishToMavenLocal" />
        </exec>
        <exec executable="cmd.exe" dir="gradle-plugin" osfamily="windows" failonerror="true">
            <arg line="/c ${basedir}\gradle-plugin\gradlew.bat assemble publishToMavenLocal" />
        </exec>
    </target>

    <target name="maven-install" depends="install-fj">
        <mvn mavenversion="3.0.5" dir="maven-plugin" pom="maven-plugin/pom.xml">
            <arg value="install" />
        </mvn>
    </target>

    <target name="build-and-install" depends="gradle-install,maven-install">
        <echo message="Done" />
    </target>
</project>