xref: /trunk/main/solenv/ant/idl.xml (revision a622bb93)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23
24<project name="idl" xmlns:if="ant:if" xmlns:unless="ant:unless">
25
26    <dirname property="idl.basedir" file="${ant.file.idl}"/>
27
28    <!-- global properties -->
29    <property file="${idl.basedir}/../../ant.properties"/>
30
31
32
33    <property name="idl.build.dir" location="${build.base.dir}/idl"/>
34    <property name="idl.urd.build.dir" location="${idl.build.dir}/urd"/>
35    <property name="idl.rdb.build.dir" location="${idl.build.dir}/rdb"/>
36    <property name="idl.classes.build.dir" location="${idl.build.dir}/classes"/>
37    <property name="idl.javamaker.flag" location="${idl.build.dir}/idl.javamaker.flag"/>
38
39    <target name="idl">
40        <check-idl/>
41        <build-idl unless:set="idl.uptodate"/>
42    </target>
43
44    <macrodef name="check-idl">
45        <sequential>
46            <local name="idl.files.exist"/>
47            <condition property="idl.files.exist">
48                <resourcecount refid="idl.files" when="greater" count="0"/>
49            </condition>
50
51            <local name="idl.files.union"/>
52            <union id="idl.files.union" if:set="idl.files.exist">
53                <filelist refid="idl.files"/>
54            </union>
55            <uptodate property="idl.uptodate" targetfile="${idl.javamaker.flag}" if:set="idl.files.exist">
56                <srcresources refid="idl.files.union"/>
57            </uptodate>
58            <property name="idl.uptodate" value="true" unless:set="idl.files.exist"/>
59        </sequential>
60    </macrodef>
61
62    <macrodef name="build-idl">
63        <sequential>
64            <idlc/>
65            <regmerge/>
66            <javamaker
67                inputRdb="${idl.rdb.build.dir}/registry.rdb"
68                outputDirectory="${idl.classes.build.dir}"
69                noDependentTypes="true"
70                excludes="${OUTDIR}/bin/types.rdb"/>
71            <touch file="${idl.javamaker.flag}"/>
72        </sequential>
73    </macrodef>
74
75    <macrodef name="idlc">
76        <sequential>
77            <mkdir dir="${idl.urd.build.dir}"/>
78            <apply executable="${OUTDIR}/bin/idlc" failonerror="true">
79                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
80                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
81                <arg value="-I${OUTDIR}/idl"/>
82                <arg value="-O"/>
83                <arg value="${idl.urd.build.dir}"/>
84                <arg value="-verbose"/>
85                <arg value="-cid"/>
86                <arg value="-we"/>
87                <filelist refid="idl.files"/>
88            </apply>
89        </sequential>
90    </macrodef>
91
92    <macrodef name="regmerge">
93        <sequential>
94            <mkdir dir="${idl.rdb.build.dir}"/>
95            <delete file="${idl.rdb.build.dir}/registry.rdb"/>
96            <apply executable="${OUTDIR}/bin/regmerge" failonerror="true">
97                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
98                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
99                <arg value="${idl.rdb.build.dir}/registry.rdb"/>
100                <arg value="/UCR"/>
101                <fileset dir="${idl.urd.build.dir}" includes="**/*.urd"/>
102            </apply>
103        </sequential>
104    </macrodef>
105
106    <macrodef name="javamaker">
107        <attribute name="inputRdb"/>
108        <attribute name="outputDirectory"/>
109        <attribute name="noDependentTypes" default="false"/>
110        <attribute name="excludes" default=""/>
111        <sequential>
112            <mkdir dir="@{outputDirectory}"/>
113            <exec executable="${OUTDIR}/bin/javamaker" failonerror="true">
114                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
115                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
116                <arg value="-O@{outputDirectory}"/>
117                <arg value="-BUCR"/>
118                <arg value="-nD"
119                    if:true="@{noDependentTypes}"/>
120                <arg value="@{inputRdb}"/>
121                <arg value="-X@{excludes}"
122                    unless:blank="@{excludes}"/>
123            </exec>
124        </sequential>
125    </macrodef>
126</project>
127
128