xref: /trunk/main/solenv/ant/idl.xml (revision 4aa87146)
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    <macrodef name="idl-javamaker">
32        <attribute name="idlFiles"/>
33        <attribute name="idlBuildDir"/>
34        <sequential>
35            <local name="idl.javamaker.flag"/>
36            <property name="idl.javamaker.flag" location="@{idlBuildDir}/idl.javamaker.flag"/>
37
38            <local name="idl.uptodate"/>
39            <condition property="idl.uptodate">
40                <resourcecount property="idl.uptodate" when="equal" count="0">
41                    <resources refid="@{idlFiles}"/>
42                </resourcecount>
43            </condition>
44
45            <uptodate property="idl.uptodate" targetfile="${idl.javamaker.flag}" unless:set="idl.uptodate">
46                <srcfiles refid="@{idlFiles}"/>
47            </uptodate>
48            <build-idl
49                idlFiles="@{idlFiles}"
50                idlBuildDir="@{idlBuildDir}"
51                targetFlagFile="${idl.javamaker.flag}"
52                unless:set="idl.uptodate"/>
53        </sequential>
54    </macrodef>
55
56    <macrodef name="build-idl">
57        <attribute name="idlFiles"/>
58        <attribute name="idlBuildDir"/>
59        <attribute name="targetFlagFile"/>
60        <sequential>
61            <idlc
62                idlFiles="@{idlFiles}"
63                urdDir="@{idlBuildDir}/urd"/>
64            <regmerge
65                urdDir="@{idlBuildDir}/urd"
66                rdbFile="@{idlBuildDir}/registry.rdb"/>
67            <javamaker
68                rdbFile="@{idlBuildDir}/registry.rdb"
69                outputDir="@{idlBuildDir}/classes"
70                noDependentTypes="true"
71                excludes="${OUTDIR}/bin/types.rdb"/>
72            <touch file="@{targetFlagFile}"/>
73        </sequential>
74    </macrodef>
75
76    <macrodef name="idlc">
77        <attribute name="idlFiles"/>
78        <attribute name="urdDir"/>
79        <sequential>
80            <mkdir dir="@{urdDir}"/>
81            <apply executable="${OUTDIR}/bin/idlc" failonerror="true">
82                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
83                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
84                <arg value="-I${OUTDIR}/idl"/>
85                <arg value="-O"/>
86                <arg value="@{urdDir}"/>
87                <arg value="-verbose"/>
88                <arg value="-cid"/>
89                <arg value="-we"/>
90                <fileset refid="@{idlFiles}"/>
91            </apply>
92        </sequential>
93    </macrodef>
94
95    <macrodef name="regmerge">
96        <attribute name="urdDir"/>
97        <attribute name="rdbFile"/>
98        <sequential>
99            <delete file="@{rdbFile}"/>
100            <apply executable="${OUTDIR}/bin/regmerge" failonerror="true">
101                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
102                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
103                <arg value="@{rdbFile}"/>
104                <arg value="/UCR"/>
105                <fileset dir="@{urdDir}" includes="**/*.urd"/>
106            </apply>
107        </sequential>
108    </macrodef>
109
110    <macrodef name="javamaker">
111        <attribute name="rdbFile"/>
112        <attribute name="outputDir"/>
113        <attribute name="noDependentTypes" default="false"/>
114        <attribute name="excludes" default=""/>
115        <sequential>
116            <mkdir dir="@{outputDir}"/>
117            <exec executable="${OUTDIR}/bin/javamaker" failonerror="true">
118                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
119                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
120                <arg value="-O@{outputDir}"/>
121                <arg value="-BUCR"/>
122                <arg value="-nD"
123                    if:true="@{noDependentTypes}"/>
124                <arg value="@{rdbFile}"/>
125                <arg value="-X@{excludes}"
126                    unless:blank="@{excludes}"/>
127            </exec>
128        </sequential>
129    </macrodef>
130
131</project>
132
133