summaryrefslogtreecommitdiff
path: root/docs/man/build.xml
blob: 6973f4d97c75052a7389c320a5c4276f37407c6a (plain) (blame)
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->

<project name="scala-manpages" default="build">

  <property environment="env"/>
  <property file="${basedir}/build.properties"/>

  <property name="scala.lib.dir" value="../../lib"/>
  <property name="scala-library.jar" value="${scala.lib.dir}/scala-library.jar"/>
  <property name="scala-compiler.jar" value="${scala.lib.dir}/scala-compiler.jar"/>

  <property name="src.dir" value="${basedir}/src"/>
  <property name="build.dir" value="${basedir}/classes"/>
  <property name="dist.dir" value="${basedir}/dists"/>

  <target name="init">
    <echo level="verbose">scala.lib.dir=${scala.lib.dir}</echo>
    <fail message="A required Scala library is missing.">
      <condition><not><and>
        <available file="${scala-library.jar}"/>
        <available file="${scala-compiler.jar}"/>
      </and></not></condition>
    </fail>
    <path id="scala.classpath">
      <pathelement location="${scala-library.jar}"/>
      <pathelement location="${scala-compiler.jar}"/>
    </path>
    <taskdef
      name="scalac"
      classname="scala.tools.ant.Scalac"
      classpathref="scala.classpath"
    />
    <path id="build.classpath">
      <pathelement location="${scala-library.jar}"/>
      <pathelement location="${build.dir}"/>
    </path>
  </target>

  <target name="build" depends="init">
    <mkdir dir="${build.dir}"/>
    <scalac
      srcdir="${src.dir}"
      destdir="${build.dir}"
      classpathref="build.classpath"
    />
  </target>

  <target name="dist" depends="build">
    <mkdir dir="${dist.dir}"/>
    <emit command="sbaz"/>
    <emit command="scala"/>
    <emit command="scalac"/>
    <emit command="scaladoc"/>
    <emit command="scalaint"/>
    <emit command="scalap"/>
    <emit command="scalascript"/>
    <!--<fixcrlf srcdir="${dist.dir}" eol="lf"/>-->
    <copy todir="${dist.dir}">
      <fileset dir="${src.dir}">
        <include name="**/*.html"/>
        <include name="**/*.css"/>
        <include name="**/*.gif"/>
        <include name="**/*.png"/>
      </fileset>
    </copy>
  </target>

  <macrodef name="emit">
    <attribute name="command"/>
    <sequential>
      <java classname="man.EmitHtml"
        output="${dist.dir}/@{command}.html"
        classpathref="build.classpath"
        fork="true" logError="yes"
      >
        <arg value="@{command}"/>
      </java>
      <java classname="man.EmitManPage"
        output="${dist.dir}/@{command}.1"
        classpathref="build.classpath"
        logError="yes" fork="true"
      >
        <arg value="@{command}"/>
      </java>
    </sequential>
  </macrodef>

  <macrodef name="remove">
    <attribute name="dir"/>
    <sequential>
      <delete dir="@{dir}"
              includeemptydirs="yes"
              quiet="yes"
              failonerror="no"/>
    </sequential>
  </macrodef>

  <target name="clean">
    <remove dir="${build.dir}"/>
  </target>

  <target name="clean.all">
    <remove dir="${build.dir}"/>
    <remove dir="${dist.dir}"/>
  </target>

</project>